Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clarifying the instance_write option with an example

  • Loading branch information...
commit eb902d6c00f64e7060f24fa3b243d5b6dea98cac 1 parent ff7e17d
@neerajdotname neerajdotname authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 activesupport/lib/active_support/core_ext/class/attribute.rb
View
6 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]
Please sign in to comment.
Something went wrong with that request. Please try again.