Cucumber_rails' old-school web-steps have been deprecated for a while, urging developers to write high-level step definitions...

If you want to update some records with boolean fields in a migration, always remember to set your values with...

Assuming the following sunspot setup of the post class: class Post < ActiveRecord::Base searchable do text :title string :state

Note: Instead of using the method in this card, you probably want to use ActiveType's nested attributes which is...

makandra dev
api.rubyonrails.org

Methods to remove e.g. order or conditions from an existing scope chain.

Be careful when stubbing out attributes on records that are defined by associations. Nothing is as it seems to be...

So you got this error, even though your Gemfile bundles mysql2: !!! Missing the mysql2 gem. Add it to your Gemfile...

assignable_values now lets you define a secondary default that is only used if the primary default value is not...

You can use String#demodulize from ActiveSupport: "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections" "Inflections".demodulize # => "Inflections"

Don't say is_a?(ActiveRecord::NamedScope::Scope) because that is no longer true in Rails 3 and also doesn...

github.com

paper_trail is an excellent gem to track record versions and changes. You almost never want to reimplement something like...

Sometimes, you may want to open up a second database connection, to a read slave or another database. When doing...

In Rails 3.1+, instead of defining a separate up and down method you can define a single method change:

Note that this seems to affect only recent Rails 2 versions. You will not encounter this until you are writing...

Localizing a non-trivial application can be a huge undertaking. This card will give you an overview over the many...

When requests arrive at the application servers simultaneously, weird things can happen. Sometimes, this can also happen if a user...

If you get an error like this ... can’t find executable rails for rails-3.2.3 (Gem::Exception) ... one of several...

All our projects have enum-like requirements like this: An attribute value must be included in a given set of...

An association defined with has_many :through will return the same record multiple times if multiple join models for the...

Geordi, our collection of command line tools, has been extended by another command deploy-to-production. This script encapsulates the...

makandra dev

When you are calling a method that may raise an exception that you don't care about, you might think...

Undeterministically I got a nil error on saving the object caused by the random order of hash elements of the...

Let's say you need to revert a migration that happened a while back. You'd create a new migration...

When your model is using a callback like before_save or before_validation to calculate an aggregated value from its...