Please sign in to comment.
Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an opt…
…ions 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: José Valim <email@example.com>
- Loading branch information...
Showing with 315 additions and 441 deletions.
- +39 −13 activemodel/lib/active_model/errors.rb
- +2 −2 activemodel/lib/active_model/validations/acceptance.rb
- +3 −3 activemodel/lib/active_model/validations/confirmation.rb
- +3 −2 activemodel/lib/active_model/validations/exclusion.rb
- +3 −3 activemodel/lib/active_model/validations/format.rb
- +3 −2 activemodel/lib/active_model/validations/inclusion.rb
- +6 −2 activemodel/lib/active_model/validations/length.rb
- +9 −4 activemodel/lib/active_model/validations/numericality.rb
- +1 −1 activemodel/lib/active_model/validations/presence.rb
- +41 −41 activemodel/test/cases/validations/i18n_generate_message_validation_test.rb
- +169 −338 activemodel/test/cases/validations/i18n_validation_test.rb
- +1 −1 activerecord/lib/active_record/validations/associated.rb
- +1 −1 activerecord/lib/active_record/validations/uniqueness.rb
- +6 −6 activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
- +28 −22 activerecord/test/cases/validations/i18n_validation_test.rb
Oops, something went wrong.