diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class/attribute_accessors.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute_accessors.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb index 5cb528cfe9..4f8866ce9d 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb @@ -15,6 +15,14 @@ require 'active_support/core_ext/array/extract_options' # Person.hair_colors # => [:brown, :black, :blonde, :red] # Person.new.hair_colors # => [:brown, :black, :blonde, :red] # +# class Female < Person +# end +# +# Female.hair_colors << :pink +# Female.hair_colors # => [:brown, :black, :blonde, :red, :pink] +# Female.new.hair_colors # => [:brown, :black, :blonde, :red, :pink] +# Person.hair_colors # => [:brown, :black, :blonde, :red, :pink] +# # To opt out of the instance writer method, pass :instance_writer => false. # To opt out of the instance reader method, pass :instance_reader => false. # To opt out of both instance methods, pass :instance_accessor => false. |