aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-04-11 17:47:55 +0200
committerJosé Valim <jose.valim@gmail.com>2011-04-11 17:47:59 +0200
commitdf5691aa94f209a59945d60d750a5040b24dbc40 (patch)
tree4945b12139eb5ea358974af1d9e97656c523405f /activemodel/lib
parent5bf3d46becdec8705681b8914376a26a6c759dae (diff)
downloadrails-df5691aa94f209a59945d60d750a5040b24dbc40.tar.gz
rails-df5691aa94f209a59945d60d750a5040b24dbc40.tar.bz2
rails-df5691aa94f209a59945d60d750a5040b24dbc40.zip
No need to rescue here. Invoking the wrong method in an object can happen anywhere if you are not careful. In other words, test your shit.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations/exclusion.rb2
-rw-r--r--activemodel/lib/active_model/validations/format.rb2
-rw-r--r--activemodel/lib/active_model/validations/inclusion.rb2
3 files changed, 0 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb
index abc1bfae78..d135d0164a 100644
--- a/activemodel/lib/active_model/validations/exclusion.rb
+++ b/activemodel/lib/active_model/validations/exclusion.rb
@@ -19,8 +19,6 @@ module ActiveModel
if exclusions.send(inclusion_method(exclusions), value)
record.errors.add(attribute, :exclusion, options.except(:in).merge!(:value => value))
end
- rescue NoMethodError
- raise ArgumentError, "Exclusion validation for :#{attribute} in #{record.class.name}: #{ERROR_MESSAGE}"
end
private
diff --git a/activemodel/lib/active_model/validations/format.rb b/activemodel/lib/active_model/validations/format.rb
index 2ec052c74b..349e110a4b 100644
--- a/activemodel/lib/active_model/validations/format.rb
+++ b/activemodel/lib/active_model/validations/format.rb
@@ -19,8 +19,6 @@ module ActiveModel
raise ArgumentError, "A proc or lambda given to :without option must returns a regular expression"
end
end
- rescue TypeError
- raise ArgumentError, "A proc or lambda given to :with or :without option must returns a regular expression"
end
def check_validity!
diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb
index cb46547e92..43b1d87d0b 100644
--- a/activemodel/lib/active_model/validations/inclusion.rb
+++ b/activemodel/lib/active_model/validations/inclusion.rb
@@ -19,8 +19,6 @@ module ActiveModel
unless exclusions.send(inclusion_method(exclusions), value)
record.errors.add(attribute, :inclusion, options.except(:in).merge!(:value => value))
end
- rescue NoMethodError
- raise ArgumentError, "Exclusion validation for :#{attribute} in #{record.class.name}: #{ERROR_MESSAGE}"
end
private