From bc129f1be8e37b4e7ed22317871b1e66c2682410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julia=20Lo=CC=81pez?= Date: Tue, 8 Aug 2017 16:29:35 -0400 Subject: add missing collection.reload documentation [ci skip] --- activerecord/lib/active_record/associations.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index eb1418478c..a61c0336db 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1192,8 +1192,8 @@ module ActiveRecord # has_many :clients would add among others clients.empty?. # # [collection] - # Returns an array of all the associated objects. - # An empty array is returned if none are found. + # Returns a Relation of all the associated objects. + # An empty Relation is returned if none are found. # [collection<<(object, ...)] # Adds one or more objects to the collection by setting their foreign keys to the collection's primary key. # Note that this operation instantly fires update SQL without waiting for the save or update call on the @@ -1250,6 +1250,9 @@ module ActiveRecord # [collection.create!(attributes = {})] # Does the same as collection.create, but raises ActiveRecord::RecordInvalid # if the record is invalid. + # [collection.reload] + # Returns a Relation of all of the associated objects, forcing a database read. + # An empty Relation is returned if none are found. # # === Example # @@ -1269,6 +1272,7 @@ module ActiveRecord # * Firm#clients.build (similar to Client.new("firm_id" => id)) # * Firm#clients.create (similar to c = Client.new("firm_id" => id); c.save; c) # * Firm#clients.create! (similar to c = Client.new("firm_id" => id); c.save!) + # * Firm#clients.reload # The declaration can also include an +options+ hash to specialize the behavior of the association. # # === Scopes @@ -1712,8 +1716,8 @@ module ActiveRecord # has_and_belongs_to_many :categories would add among others categories.empty?. # # [collection] - # Returns an array of all the associated objects. - # An empty array is returned if none are found. + # Returns a Relation of all the associated objects. + # An empty Relation is returned if none are found. # [collection<<(object, ...)] # Adds one or more objects to the collection by creating associations in the join table # (collection.push and collection.concat are aliases to this method). @@ -1751,6 +1755,9 @@ module ActiveRecord # Returns a new object of the collection type that has been instantiated # with +attributes+, linked to this object through the join table, and that has already been # saved (if it passed the validation). + # [collection.reload] + # Returns a Relation of all of the associated objects, forcing a database read. + # An empty Relation is returned if none are found. # # === Example # @@ -1769,6 +1776,7 @@ module ActiveRecord # * Developer#projects.exists?(...) # * Developer#projects.build (similar to Project.new("developer_id" => id)) # * Developer#projects.create (similar to c = Project.new("developer_id" => id); c.save; c) + # * Developer#projects.reload # The declaration may include an +options+ hash to specialize the behavior of the association. # # === Scopes -- cgit v1.2.3