From 596c16f1db68ff13dce2e9744f1470a80b2c96dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Sch=C3=BCttel?= Date: Thu, 21 Jun 2012 15:29:28 +0200 Subject: [PATCH] fixed readonly attribute check, uses now string ActiveRecord.readonly_attributes returns a set of strings, not a set of symbols. Verified with Rails 2.3 and 3.2. --- lib/simple_form/components/readonly.rb | 2 +- test/support/models.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/simple_form/components/readonly.rb b/lib/simple_form/components/readonly.rb index 504072e1..f4a986c2 100644 --- a/lib/simple_form/components/readonly.rb +++ b/lib/simple_form/components/readonly.rb @@ -15,7 +15,7 @@ module SimpleForm def readonly_attribute? object.class.respond_to?(:readonly_attributes) && object.persisted? && - object.class.readonly_attributes.include?(attribute_name) + object.class.readonly_attributes.include?(attribute_name.to_s) end end end diff --git a/test/support/models.rb b/test/support/models.rb index bb5727fe..6e1bd9d6 100644 --- a/test/support/models.rb +++ b/test/support/models.rb @@ -130,7 +130,7 @@ class User end def self.readonly_attributes - [:credit_card] + ["credit_card"] end end