Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Changeset [bc1c8d58ec45593acba614d1d0fecb49adef08ff] by Jeroen van Dijk

Revision bc1c8d58ec45593acba614d1d0fecb49adef08ff, committed by Jeroen van Dijk · May 15th, 2010 @ 07:17 PM

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).

Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again

[#4057 state:committed]

Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/bc1c8d58ec45593acba614d1d0fecb...

15 changed files

  • M activemodel/lib/active_model/errors.rb
  • M activemodel/lib/active_model/validations/acceptance.rb
  • M activemodel/lib/active_model/validations/confirmation.rb
  • M activemodel/lib/active_model/validations/exclusion.rb
  • M activemodel/lib/active_model/validations/format.rb
  • M activemodel/lib/active_model/validations/inclusion.rb
  • M activemodel/lib/active_model/validations/length.rb
  • M activemodel/lib/active_model/validations/numericality.rb
  • M activemodel/lib/active_model/validations/presence.rb
  • M activemodel/test/cases/validations/i18n_generate_message_validation_test.rb
  • M activemodel/test/cases/validations/i18n_validation_test.rb
  • M activerecord/lib/active_record/validations/associated.rb
  • M activerecord/lib/active_record/validations/uniqueness.rb
  • M activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
  • M activerecord/test/cases/validations/i18n_validation_test.rb