• J
    Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash... · 26392c4a
    Jeroen van Dijk 提交于
    Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options.
    
    This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format".
    
    Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation.
    
    Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options).
    
    Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now.
    
    The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet.
    Signed-off-by: NJosé Valim <jose.valim@gmail.com>
    26392c4a
errors.rb 11.2 KB