From 3a707e21109abfbecd499c445345707d2eb944cd Mon Sep 17 00:00:00 2001 From: Logan Hasson Date: Wed, 26 Feb 2014 11:27:04 -0500 Subject: [ci skip] Move association class method notes Make explanation of association class methods clearer by moving notes to beginning of each example section. --- activerecord/lib/active_record/associations.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 714f623af3..d6692afa75 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1034,6 +1034,9 @@ module ActiveRecord # Specifies a one-to-many association. The following methods for retrieval and query of # collections of associated objects will be added: # + # +collection+ is a placeholder for the symbol passed as the first argument, so + # has_many :clients would add among others clients.empty?. + # # [collection(force_reload = false)] # Returns an array of all the associated objects. # An empty array is returned if none are found. @@ -1092,9 +1095,6 @@ module ActiveRecord # Does the same as collection.create, but raises ActiveRecord::RecordInvalid # if the record is invalid. # - # (*Note*: +collection+ is replaced with the symbol passed as the first argument, so - # has_many :clients would add among others clients.empty?.) - # # === Example # # A Firm class declares has_many :clients, which will add: @@ -1209,6 +1209,9 @@ module ActiveRecord # # The following methods for retrieval and query of a single associated object will be added: # + # +association+ is a placeholder for the symbol passed as the first argument, so + # has_one :manager would add among others manager.nil?. + # # [association(force_reload = false)] # Returns the associated object. +nil+ is returned if none is found. # [association=(associate)] @@ -1226,9 +1229,6 @@ module ActiveRecord # Does the same as create_association, but raises ActiveRecord::RecordInvalid # if the record is invalid. # - # (+association+ is replaced with the symbol passed as the first argument, so - # has_one :manager would add among others manager.nil?.) - # # === Example # # An Account class declares has_one :beneficiary, which will add: @@ -1314,6 +1314,9 @@ module ActiveRecord # Methods will be added for retrieval and query for a single associated object, for which # this object holds an id: # + # +association+ is a placeholder for the symbol passed as the first argument, so + # belongs_to :author would add among others author.nil?. + # # [association(force_reload = false)] # Returns the associated object. +nil+ is returned if none is found. # [association=(associate)] @@ -1329,9 +1332,6 @@ module ActiveRecord # Does the same as create_association, but raises ActiveRecord::RecordInvalid # if the record is invalid. # - # (+association+ is replaced with the symbol passed as the first argument, so - # belongs_to :author would add among others author.nil?.) - # # === Example # # A Post class declares belongs_to :author, which will add: @@ -1451,6 +1451,9 @@ module ActiveRecord # # Adds the following methods for retrieval and query: # + # +collection+ is a placeholder for the symbol passed as the first argument, so + # has_and_belongs_to_many :categories would add among others categories.empty?. + # # [collection(force_reload = false)] # Returns an array of all the associated objects. # An empty array is returned if none are found. @@ -1492,9 +1495,6 @@ module ActiveRecord # with +attributes+, linked to this object through the join table, and that has already been # saved (if it passed the validation). # - # (+collection+ is replaced with the symbol passed as the first argument, so - # has_and_belongs_to_many :categories would add among others categories.empty?.) - # # === Example # # A Developer class declares has_and_belongs_to_many :projects, which will add: -- cgit v1.2.3