Permalink
Browse files

clarifying the instance_write option with an example

  • Loading branch information...
1 parent ff7e17d commit eb902d6c00f64e7060f24fa3b243d5b6dea98cac Neeraj Singh committed Jul 28, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 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]

0 comments on commit eb902d6

Please sign in to comment.