diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-07-28 10:08:00 -0400 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2010-07-28 10:08:00 -0400 |
commit | eb902d6c00f64e7060f24fa3b243d5b6dea98cac (patch) | |
tree | 510a2474ad3dea96d772e0f0e21b975241f5a0bb /activesupport/lib/active_support | |
parent | ff7e17d33e8042fa430fd637ef3433ef7367dc30 (diff) | |
download | rails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.tar.gz rails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.tar.bz2 rails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.zip |
clarifying the instance_write option with an example
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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] |