From 9de9f6b4d0422e23e1eec9c59bbda880684e45c9 Mon Sep 17 00:00:00 2001 From: mhutchin Date: Sun, 9 Oct 2011 01:50:53 -0700 Subject: [PATCH] Copy editing to improve readability and remove any potential ambiguity --- .../guides/source/association_basics.textile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 06cb199fd9..8943bfa0a3 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -566,7 +566,7 @@ The build_association method returns a new object of the assoc h6(#belongs_to-create_association). create_association(attributes = {}) -The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through this object's foreign key will be set. In addition, once it passes all of the validations specified on the associated model, the associated object _will_ be saved. +The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through this object's foreign key will be set, and, once it passes all of the validations specified on the associated model, the associated object _will_ be saved. @customer = @order.create_customer(:customer_number => 123, @@ -760,9 +760,9 @@ h6(#belongs_to-validate). +:validate+ If you set the +:validate+ option to +true+, then associated objects will be validated whenever you save this object. By default, this is +false+: associated objects will not be validated when this object is saved. -h5(#belongs_to-how_to_know_whether_theres_an_associated_object). How To Know Whether There's an Associated Object? +h5(#belongs_to-do_any_associated_objects_exist). Do Any Associated Objects Exist? -To know whether there's and associated object just check association.nil?: +You can see if any associated objects exist by using the association.nil? method: if @order.customer.nil? @@ -834,7 +834,7 @@ The build_association method returns a new object of the assoc h6(#has_one-create_association). create_association(attributes = {}) -The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, and the link through its foreign key will be set. In addition, the associated object _will_ be saved (assuming that it passes any validations). +The create_association method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through its foreign key will be set, and, once it passes all of the validations specified on the associated model, the associated object _will_ be saved. @account = @supplier.create_account(:terms => "Net 30") @@ -980,9 +980,9 @@ h6(#has_one-validate). +:validate+ If you set the +:validate+ option to +true+, then associated objects will be validated whenever you save this object. By default, this is +false+: associated objects will not be validated when this object is saved. -h5(#has_one-how_to_know_whether_theres_an_associated_object). How To Know Whether There's an Associated Object? +h5(#has_one-do_any_associated_objects_exist). Do Any Associated Objects Exist? -To know whether there's and associated object just check association.nil?: +You can see if any associated objects exist by using the association.nil? method: if @supplier.account.nil? @@ -1147,7 +1147,7 @@ The collection.build method returns one or more new objects of h6(#has_many-collection-create). collection.create(attributes = {}) -The collection.create method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through its foreign key will be created, and the associated object _will_ be saved (assuming that it passes any validations). +The collection.create method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through its foreign key will be created, and, once it passes all of the validations specified on the associated model, the associated object _will_ be saved. @order = @customer.orders.create(:order_date => Time.now, @@ -1576,7 +1576,7 @@ The collection.build method returns a new object of the associ h6(#has_and_belongs_to_many-create-attributes). collection.create(attributes = {}) -The collection.create method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through the join table will be created, and the associated object _will_ be saved (assuming that it passes any validations). +The collection.create method returns a new object of the associated type. This object will be instantiated from the passed attributes, the link through the join table will be created, and, once it passes all of the validations specified on the associated model, the associated object _will_ be saved. @assembly = @part.assemblies.create(