aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/reply.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/reply.rb')
-rw-r--r--activerecord/test/models/reply.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb
index 264a49b465..6cc9ee038a 100644
--- a/activerecord/test/models/reply.rb
+++ b/activerecord/test/models/reply.rb
@@ -17,6 +17,7 @@ class WrongReply < Reply
validate :check_empty_title
validate :check_content_mismatch, :on => :create
validate :check_wrong_update, :on => :update
+ validate :check_title_is_secret, :on => :special_case
def check_empty_title
errors[:title] << "Empty" unless attribute_present?("title")
@@ -39,6 +40,10 @@ class WrongReply < Reply
def check_wrong_update
errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update"
end
+
+ def check_title_is_secret
+ errors[:title] << "Invalid" unless title == "secret"
+ end
end
class SillyReply < Reply