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.
|
|||||
|
Use http://github.com/gumayunov/custom-err-msg/tree/master Sometimes you wish to convert one STI class to another, e.g. promote User to 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 [...] 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 During validation, Validates_presence_of :blog causes ActiveRecord [...] 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 => [...] |
|||||
|
Copyright © 2010 Sam Pierson's Blog - All Rights Reserved |
|||||