From cd13fbd8d8071b822f6d4f8967ef80c617c036ba Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Sat, 5 Feb 2011 16:44:35 -0800 Subject: Optionally pass in the attribute being validated to an instance method validator --- activemodel/test/models/topic.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activemodel/test/models/topic.rb') diff --git a/activemodel/test/models/topic.rb b/activemodel/test/models/topic.rb index 8d49c1dd27..c9af78f595 100644 --- a/activemodel/test/models/topic.rb +++ b/activemodel/test/models/topic.rb @@ -33,4 +33,8 @@ class Topic errors.add :title, "is missing" unless title end + def my_validation_with_arg(attr) + errors.add attr, "is missing" unless send(attr) + end + end -- cgit v1.2.3