From 3ae67fbebb96b7e5bf806680642345c86952959d Mon Sep 17 00:00:00 2001 From: Rizwan Reza Date: Tue, 15 Jun 2010 22:20:19 +0430 Subject: Add titles to the rest of the files in active_model/validations/* --- activemodel/lib/active_model/validations/presence.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activemodel/lib/active_model/validations/presence.rb') diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index b319f4834b..e36bee8115 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -1,6 +1,8 @@ require 'active_support/core_ext/object/blank' module ActiveModel + + # == Active Model Presence Validator module Validations class PresenceValidator < EachValidator def validate(record) -- cgit v1.2.3 From 26392c4ac57e27c63984d47c6326c13f502d5786 Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk Date: Wed, 19 May 2010 15:25:46 +0100 Subject: Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- activemodel/lib/active_model/validations/presence.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib/active_model/validations/presence.rb') diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index e36bee8115..28c4640b17 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -6,7 +6,7 @@ module ActiveModel module Validations class PresenceValidator < EachValidator def validate(record) - record.errors.add_on_blank(attributes, options[:message]) + record.errors.add_on_blank(attributes, options) end end -- cgit v1.2.3