From e5195be2d9efaee18e9204d00cdcd0a92ee407ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Sat, 25 Aug 2012 22:55:03 -0300 Subject: [PATCH] Revert "Remove private verify readonly attr method" This reverts commit 7a8aee08b610f6edbfe5be076dc14e5cdcf1355e. --- activerecord/lib/active_record/persistence.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index c64e3e6ccf..9c0a292a09 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -232,7 +232,7 @@ module ActiveRecord raise ActiveRecordError, "can not update on a new record object" unless persisted? attributes.each_key do |key| - raise ActiveRecordError, "#{key} is marked as readonly" if self.class.readonly_attributes.include?(key.to_s) + raise ActiveRecordError, "#{key.to_s} is marked as readonly" if self.class.readonly_attributes.include?(key.to_s) end attributes.each do |k,v| @@ -405,5 +405,9 @@ module ActiveRecord @new_record = false id end + + def verify_readonly_attribute(name) + raise ActiveRecordError, "#{name} is marked as readonly" if self.class.readonly_attributes.include?(name) + end end end