From 7143d80147ea26c66dfa1dd4bb82f066d72f6570 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Thu, 8 Nov 2007 03:37:16 +0000 Subject: Smattering of grammatical fixes to documentation. Closes #10083 [BobSilva] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 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 1013c75643..f6ee5e1d07 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -243,7 +243,7 @@ module ActiveRecord # # == Unsaved objects and associations # - # You can manipulate objects and associations before they are saved to the database, but there is some special behaviour you should be + # You can manipulate objects and associations before they are saved to the database, but there is some special behavior you should be # aware of, mostly involving the saving of associated objects. # # === One-to-one associations @@ -267,7 +267,7 @@ module ActiveRecord # === Association callbacks # # Similiar to the normal callbacks that hook into the lifecycle of an Active Record object, you can also define callbacks that get - # trigged when you add an object to or remove an object from an association collection. Example: + # triggered when you add an object to or remove an object from an association collection. Example: # # class Project # has_and_belongs_to_many :developers, :after_add => :evaluate_velocity @@ -584,10 +584,10 @@ module ActiveRecord # This will also destroy the objects if they're declared as +belongs_to+ and dependent on this model. # * collection=objects - replaces the collections content by deleting and adding objects as appropriate. # * collection_singular_ids - returns an array of the associated objects' ids - # * collection_singular_ids=ids - replace the collection by the objects identified by the primary keys in +ids+ + # * collection_singular_ids=ids - replace the collection with the objects identified by the primary keys in +ids+ # * collection.clear - removes every object from the collection. This destroys the associated objects if they # are associated with :dependent => :destroy, deletes them directly from the database if :dependent => :delete_all, - # or otherwise sets their foreign keys to NULL. + # otherwise sets their foreign keys to NULL. # * collection.empty? - returns +true+ if there are no associated objects. # * collection.size - returns the number of associated objects. # * collection.find - finds an associated object according to the same rules as Base.find. @@ -621,8 +621,6 @@ module ActiveRecord # SQL fragment, such as price > 5 AND name LIKE 'B%'. # * :order - specify the order in which the associated objects are returned as an ORDER BY SQL fragment, # such as last_name, first_name DESC - # * :group - specify the attribute by which the associated objects are returned as a GROUP BY SQL fragment, - # such as +category+ # * :foreign_key - specify the foreign key used for the association. By default this is guessed to be the name # of this class in lower-case and +_id+ suffixed. So a +Person+ class that makes a +has_many+ association will use +person_id+ # as the default +foreign_key+. @@ -633,13 +631,13 @@ module ActiveRecord # * :finder_sql - specify a complete SQL statement to fetch the association. This is a good way to go for complex # associations that depend on multiple tables. Note: When this option is used, +find_in_collection+ is _not_ added. # * :counter_sql - specify a complete SQL statement to fetch the size of the association. If :finder_sql is - # specified but :counter_sql, :counter_sql will be generated by replacing SELECT ... FROM with SELECT COUNT(*) FROM. + # specified but not :counter_sql, :counter_sql will be generated by replacing SELECT ... FROM with SELECT COUNT(*) FROM. # * :extend - specify a named module for extending the proxy. See "Association extensions". # * :include - specify second-order associations that should be eager loaded when the collection is loaded. # * :group: An attribute name by which the result should be grouped. Uses the GROUP BY SQL-clause. # * :limit: An integer determining the limit on the number of rows that should be returned. # * :offset: An integer determining the offset from where the rows should be fetched. So at 5, it would skip the first 4 rows. - # * :select: By default, this is * as in SELECT * FROM, but can be changed if you for example want to do a join, + # * :select: By default, this is * as in SELECT * FROM, but can be changed if you, for example, want to do a join # but not include the joined columns. # * :as: Specifies a polymorphic interface (See #belongs_to). # * :through: Specifies a Join Model through which to perform the query. Options for :class_name and :foreign_key @@ -708,8 +706,8 @@ module ActiveRecord # if the real class name is +Person+, you'll have to specify it with this option. # * :conditions - specify the conditions that the associated object must meet in order to be included as a +WHERE+ # SQL fragment, such as rank = 5. - # * :order - specify the order from which the associated object will be picked at the top. Specified as - # an ORDER BY SQL fragment, such as last_name, first_name DESC + # * :order - specify the order in which the associated objects are returned as an ORDER BY SQL fragment, + # such as last_name, first_name DESC # * :dependent - if set to :destroy, the associated object is destroyed when this object is. If set to # :delete, the associated object is deleted *without* calling its destroy method. If set to :nullify, the associated # object's foreign key is set to +NULL+. Also, association is assigned. @@ -721,7 +719,7 @@ module ActiveRecord # # Option examples: # has_one :credit_card, :dependent => :destroy # destroys the associated credit card - # has_one :credit_card, :dependent => :nullify # updates the associated records foreign key value to null rather than destroying it + # has_one :credit_card, :dependent => :nullify # updates the associated records foreign key value to NULL rather than destroying it # has_one :last_comment, :class_name => "Comment", :order => "posted_on" # has_one :project_manager, :class_name => "Person", :conditions => "role = 'project_manager'" # has_one :attachment, :as => :attachable @@ -771,12 +769,12 @@ module ActiveRecord # if the real class name is +Person+, you'll have to specify it with this option. # * :conditions - specify the conditions that the associated object must meet in order to be included as a +WHERE+ # SQL fragment, such as authorized = 1. - # * :order - specify the order from which the associated object will be picked at the top. Specified as - # an ORDER BY SQL fragment, such as last_name, first_name DESC + # * :order - specify the order in which the associated objects are returned as an ORDER BY SQL fragment, + # such as last_name, first_name DESC # * :foreign_key - specify the foreign key used for the association. By default this is guessed to be the name # of the associated class in lower-case and +_id+ suffixed. So a +Person+ class that makes a +belongs_to+ association to a # +Boss+ class will use +boss_id+ as the default +foreign_key+. - # * :counter_cache - caches the number of belonging objects on the associate class through use of +increment_counter+ + # * :counter_cache - caches the number of belonging objects on the associate class through the use of +increment_counter+ # and +decrement_counter+. The counter cache is incremented when an object of this class is created and decremented when it's # destroyed. This requires that a column named #{table_name}_count (such as +comments_count+ for a belonging +Comment+ class) # is used on the associate class (such as a +Post+ class). You can also specify a custom counter cache column by providing @@ -924,7 +922,8 @@ module ActiveRecord # the +has_and_belongs_to_many+ association will use +project_id+ as the default association +foreign_key+. # * :conditions - specify the conditions that the associated object must meet in order to be included as a +WHERE+ # SQL fragment, such as authorized = 1. - # * :order - specify the order in which the associated objects are returned as a ORDER BY SQL fragment, such as last_name, first_name DESC + # * :order - specify the order in which the associated objects are returned as an ORDER BY SQL fragment, + # such as last_name, first_name DESC # * :uniq - if set to +true+, duplicate associated objects will be ignored by accessors and query methods # * :finder_sql - overwrite the default generated SQL statement used to fetch the association with a manual statement # * :delete_sql - overwrite the default generated SQL statement used to remove links between the associated -- cgit v1.2.3