How to stop ActiveRecord putting attribute name in validation message

Use http://github.com/gumayunov/custom-err-msg/tree/master
Put a ^ at the start of the :message => option:
Non-base messages are prefixed with the attribute name as usual UNLESS they begin with ‘^’
in which case the attribute name is omitted.

Switching an ActiveRecord instance between STI classes

Sometimes you wish to convert one STI class to another, e.g. promote User to Administrator.
ActiveRecord::Base#becomes(Klass) returns an instance of the current record converted to the specified Klass, e.g.:

 
user = User.find_by_login("sam")
user.becomes(Administrator)

Note however that this does not change the type attribute of the instance, so you still have an additional step to do if you want this [...]

ActiveRecord performance: validation and associations

If you have two models associated in some way, it is usual to add a validates_presence_of validator to ensure that the models are connected before saving. However, be aware that there are two ways of doing this with different performance ramifications:

class BlogEntry < ActiveRecord::Base
belongs_to :blog
validate_presence_of :blog
end

During validation, Validates_presence_of :blog causes ActiveRecord [...]

ActiveRecord eager-loading thru multiple associations

I just found out how to do something I have been wondering for a long time: :include syntax to eager-load through multiple associations. In the rdoc for class ActiveRecord::Associations::ClassMethods I discovered you can nest include statements in hashes as follows: If for example table_a has_many table_b and table_b has_many table_c and table_c has_many table_d:

Model.find :first, :include => [...]