diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-05 22:56:15 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-05 22:56:15 +0200 |
commit | d62700f7dc0082b0acd9129350af23ee93ab6e19 (patch) | |
tree | 38c0144c06d29f0a885c909b0339ce440ea6950e /activesupport/lib | |
parent | 1ca18a6f858a257cf495e9dec7573374b1f3b01e (diff) | |
parent | 02e711bf1c2afe13a84ded3167bb633dcb4f8cb7 (diff) | |
download | rails-d62700f7dc0082b0acd9129350af23ee93ab6e19.tar.gz rails-d62700f7dc0082b0acd9129350af23ee93ab6e19.tar.bz2 rails-d62700f7dc0082b0acd9129350af23ee93ab6e19.zip |
Merge remote branch 'docrails/master'
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 85cd4db002..7290c971f9 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -526,7 +526,8 @@ module ActiveSupport # This macro accepts the following options: # # * <tt>:terminator</tt> - Indicates when a before filter is considered - # to be halted. + # to halted. This is a string to be eval'ed and has the result of the + # very filter available in the <tt>result</tt> variable: # # define_callbacks :validate, :terminator => "result == false" # diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb index 92d6dbadd4..d7a30cf123 100644 --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb @@ -5,6 +5,10 @@ require 'active_support/core_ext/array/extract_options' module ClassInheritableAttributes # :nodoc: end +# It is recommend to use <tt>class_attribute</tt> over methods defined in this file. Please +# refer to documentation for <tt>class_attribute</tt> for more information. Officially it is not +# deprected but <tt>class_attribute</tt> is faster. +# # Allows attributes to be shared within an inheritance hierarchy. Each descendant gets a copy of # their parents' attributes, instead of just a pointer to the same. This means that the child can add elements # to, for example, an array without those additions being shared with either their parent, siblings, or @@ -12,6 +16,24 @@ end # # The copies of inheritable parent attributes are added to subclasses when they are created, via the # +inherited+ hook. +# +# class Person +# class_inheritable_accessor :hair_colors +# end +# +# Person.hair_colors = [:brown, :black, :blonde, :red] +# Person.hair_colors #=> [:brown, :black, :blonde, :red] +# Person.new.hair_colors #=> [:brown, :black, :blonde, :red] +# +# To opt out of the instance writer method, pass :instance_writer => false. +# To opt out of the instance reader method, pass :instance_reader => false. +# +# class Person +# cattr_accessor :hair_colors :instance_writer => false, :instance_reader => false +# end +# +# Person.new.hair_colors = [:brown] # => NoMethodError +# Person.new.hair_colors # => NoMethodError class Class # :nodoc: def class_inheritable_reader(*syms) options = syms.extract_options! |