Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card.

web.archive.org

When you have a Cucumber step like Then I should see "Did you see those \"quotation marks\" over there...

On 32bit systems, the maximum representable Time is 2038-01-19 03:14:07 in UTC or 2038-01-19...

To test whether two arrays have the same elements regardless of order, you can use the =~ matcher in RSpec < 2.11...

The code below shows a method #validate which uses Nokogiri to validate an XML document against an XSD schema. It...

When you use the send_file method to send a local file to the browser, you can save resources on...

A check if two date or time ranges A and B overlap needs to cover a lot of cases:

Note: Consider not doing this. Use form models or vanilla methods instead. The :conditions option for Rails associations cannot take...

Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...

Given those modules: module A def foo; end def bar; end end module B end When you want to call...

Given group size If you would like to split a Ruby array into pairs of two, you can use the...

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

When defining a trait using the Modularity gem, you must take extra steps to define constants to avoid caveats (like...

In case https://www.rubydoc.info/ is to slow or offline, you can also read a gem documentation offline. Start a server...

opensoul.org

I love ETags, but there’s something that annoys me: most implementations revolve around pulling a record out of a...

If you're on Ubuntu: sudo apt-get install ruby-dev On other platforms: Look for a package containing ruby...

This is for those who already own an SSL certificate (e.g. using it in the Apache HTTP Server) and need...

You cannot use Array#join on an array of strings where some strings are html_safe and others are not...

When you are using Apache for development, it still accepts connections from everyone in the same network as you.

Update: This trick probably isn't very useful anymore in Ruby 2.x. The Ruby GC has improved a lot...

justinfrench.com

If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec...

kernel.org

Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.

If you want to iterate over a Range, but only look at every n-th element, use the step method...

Our collection of the most useful Cucumber steps, Spreewald, now supports exact matching of form fields and lets you use...