Rails 5 migration classes look like this now: class CreateUsers < ActiveRecord::Migration[5.0] Mind the [5.0] at the end.
ActiveSupport::Notifications provides an instrumentation API for Ruby. It is used throughout rails to publish instrumentation events that include information...
We have a new gem Minidusen which extracts Dusen's query parsing and LIKE query functionality. Minidusen can no longer...
Sometimes you want to test migrations with production or staging data. Dumping single tables makes sense if a complete dump...
To check the currently running PG version from your Rails application (e.g. Rails console on your production server), simply do...
When your controller action raises an unhandled exception, Rails will look at the exception's class and choose an appropriate...
Apparently you can pash a second scope to a hash-condition and the whole thing will be evaluated as a...
This is quite an edge case, and appears like a bug in Rails (4.2.6) to me. Update: This is now...
When ActiveRecord child objects are autosaved in Rails.
to create a Gallery that has a name and has_many :images, which in turn have a...
When you run rake db:rollback and nothing happens, you are probably missing the latest migration file (or have not...
Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel for Rails 4.x...
ActiveRecord offers an explain method similar to using EXPLAIN SQL statements on the database. However, this approach will explain all...
When dealing with time zones in Rails, there is one key fact to keep in mind: Rails has configurable time...
Stackprof is a sampling call-stack profile for Ruby 2.1+. Instead of tracking all method calls, it will simply collect...
Our preferred way of testing ActiveRecord is to simply create/update/destroy the record and then check if the expected behavior has...
Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...
Geordi is now (partially) tested with Cucumber. Yay! geordi cucumber supports a new @solo tag. Scenarios tagged with @solo...
Using Scenic, you can bring the power of SQL views to your Rails application without having to switch your schema...
When dealing with AR scopes, you can remove conditions, order, etc by using the unscope method. It is available on...
Rails 4 introduced raising an error on pending migrations. This is most annoying when you are crafting a migration but...
Rails 5 will introduce ActiveRecord::Relation#or. On Rails 4 and 3.2 you can use the activerecord_any_of gem...
It smells. Rethink your code design. Code example with makandra/has_defaults: class Post < ActiveRecord::Base has_defaults tags: [] # field in db...
As you most likely know validates_uniqness_of :foreign_id does not allow nil values by default.