From eb902d6c00f64e7060f24fa3b243d5b6dea98cac Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 28 Jul 2010 10:08:00 -0400 Subject: clarifying the instance_write option with an example --- activesupport/lib/active_support/core_ext/class/attribute.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index cee3f04354..af8202ae2c 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -41,7 +41,11 @@ class Class # # To opt out of the instance writer method, pass :instance_writer => false. # - # object.setting = false # => NoMethodError + # class Base + # class_attribute :setting, :instance_write => false + # end + # + # Base.new.setting = false # => NoMethodError def class_attribute(*attrs) instance_writer = !attrs.last.is_a?(Hash) || attrs.pop[:instance_writer] -- cgit v1.2.3