aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-07-28 10:08:00 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2010-07-28 10:08:00 -0400
commiteb902d6c00f64e7060f24fa3b243d5b6dea98cac (patch)
tree510a2474ad3dea96d772e0f0e21b975241f5a0bb
parentff7e17d33e8042fa430fd637ef3433ef7367dc30 (diff)
downloadrails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.tar.gz
rails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.tar.bz2
rails-eb902d6c00f64e7060f24fa3b243d5b6dea98cac.zip
clarifying the instance_write option with an example
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb6
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]