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...

makandra dev

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

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

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...

See our new comprehensive guide to upgrading every Rails 2 version ever.

When you need to see the content of a page (i.e. not all the HTML but the relevant text body...

makandra dev
railsforzombies.org

Learning Rails for the first time should be fun, and Rails for Zombies allows you to get your feet wet...

So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...

gurge.com

How to write to the db 27,000 times in 24 seconds instead of 9 minutes.

When you eagerly load an association list using the .include option, and at the same time have a .where on...

opensoul.org

Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...

snippets.dzone.com

These two models can be used to access the posts and associated comments of a WordPress database.

This card explains how to install RubyMine for the first time. If you want to upgrade an existing RubyMine installation...

avdi.org

When rendering a partial with the :collection option, you are automatically provided with a counter variable inside the partial template...

Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...

Don't insert table rows in a Rails database migration. This will break tests that expect that database to be...

Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...

alfajango.com

There is a problem with AJAX response handling for Rails 3 remote links and forms in Internet Explorer. This problem...

alfajango.com

Thanks to habits engrained by Rails 2’s link_to_remote and remote_form_for, we expect that Rails 3...

blog.jcoglan.com

Terminus is a Capybara driver where most of the driver functions are implemented in client-side JavaScript. It lets you...

github.com

Sometimes you inherit a non Rails or non Rack based web app such as PHP, Perl, Java / JEE, etc. I...