This project is archived and is in readonly mode.

Changeset [bc1c8d58ec45593acba614d1d0fecb49adef08ff] 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...

Committed by Jeroen van Dijk

  • 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

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>