From 088c11658aa6b79d05e9014201d585c7700669aa Mon Sep 17 00:00:00 2001 From: Eric Hutzelman Date: Thu, 20 Feb 2014 19:17:48 -0600 Subject: Fix some validators when used on model instance Now that Validator #setup is called from the initializer, we need a reference to the model's class to be passed in to allow the validators to continue functioning when used at the instance level. Closes #14134. --- activemodel/test/models/automobile.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activemodel/test/models') diff --git a/activemodel/test/models/automobile.rb b/activemodel/test/models/automobile.rb index ece644c40c..4df2fe8b3a 100644 --- a/activemodel/test/models/automobile.rb +++ b/activemodel/test/models/automobile.rb @@ -3,10 +3,11 @@ class Automobile validate :validations - attr_accessor :make, :model + attr_accessor :make, :model, :approved def validations validates_presence_of :make validates_length_of :model, within: 2..10 + validates_acceptance_of :approved, allow_nil: false end end -- cgit v1.2.3