aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/reply.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-03-19 23:28:59 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-19 23:28:59 +0000
commit8828b2ca674acfa028a3c1e086a1795d3bb893e1 (patch)
tree17a0b5793d99e0c0a05f31c70adea642946a87a3 /activerecord/test/models/reply.rb
parent6ed42ebdff05f9d28a60e91093d8f9afad03a958 (diff)
downloadrails-8828b2ca674acfa028a3c1e086a1795d3bb893e1.tar.gz
rails-8828b2ca674acfa028a3c1e086a1795d3bb893e1.tar.bz2
rails-8828b2ca674acfa028a3c1e086a1795d3bb893e1.zip
Move all the Active Record validations to Active Model
Diffstat (limited to 'activerecord/test/models/reply.rb')
-rw-r--r--activerecord/test/models/reply.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb
index 1c990acab6..55e7ccd22f 100644
--- a/activerecord/test/models/reply.rb
+++ b/activerecord/test/models/reply.rb
@@ -12,25 +12,25 @@ class Reply < Topic
attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read
def validate
- errors.add("title", "Empty") unless attribute_present? "title"
+ errors[:title] << "Empty" unless attribute_present?("title")
end
def errors_on_empty_content
- errors.add("content", "Empty") unless attribute_present? "content"
+ errors[:content] << "Empty" unless attribute_present?("content")
end
def validate_on_create
if attribute_present?("title") && attribute_present?("content") && content == "Mismatch"
- errors.add("title", "is Content Mismatch")
+ errors[:title] << "is Content Mismatch"
end
end
def title_is_wrong_create
- errors.add("title", "is Wrong Create") if attribute_present?("title") && title == "Wrong Create"
+ errors[:title] << "is Wrong Create" if attribute_present?("title") && title == "Wrong Create"
end
def validate_on_update
- errors.add("title", "is Wrong Update") if attribute_present?("title") && title == "Wrong Update"
+ errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update"
end
end