This page lists many query methods and options in ActiveRecord which do not sanitize raw SQL arguments and are not...
The Edge Rider gem gives your relations a method #traverse_association which returns a new relation by "pivoting" around a...
validates_uniqueness_of is not sufficient to ensure the uniqueness of a value. The reason for this is that in...
In theory you can take any scope and extend it with additional joins or conditions. We call this chaining scopes...
The next version of MySQL will include a built-in memcached daemon. This daemon can quickly get and set key/value...
When requests arrive at the application servers simultaneously, weird things can happen. Sometimes, this can also happen if a user...
After you configured your ODBC describe in Fix [RubyODBC]Cannot allocate SQLHENV when connecting to MSSQL 2005 with Ruby 1.8.7...
I followed this nice guide Connecting to MSSQL with Ruby on Ubuntu - lambie.org until I ran in the following errors...
Ever seen this error when using Graticule? Numerical argument out of domain - acos Similarly to the to_sql problem for...
The SQL code generated by Graticule's spherical distance computation is insufficient and can lead to NULL distances in edge...
Using rename_column, remove_column, etc. more than once in a migration makes that migration run slower than it should...
When you have objects in your database that hold latitude and longitude and you want to find others that are...
Instead of running all missing migrations on your test database with rake db:migrate RAILS_ENV=test you can also...
You can use heredoc to avoid endlessly long lines of code that nobody can read. Heredoc strings preserve linebreaks and...
Here is a way to create a duplicate of one database, with all its tables and their data, under a...
While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals...
When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never...
User.active.to_sql Rails 2 Use either the Edge Rider or fake_arel gem to get #to_sql backported...
There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...
Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...
When you load a record with find options that have SQL fragments in :select or :joins, ActiveRecord will make that...
Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...
This may be awkward to set up, but will work once you're done. Fun facts: