Skip to content
Browse files

Fixes in associations_basics guide.

  • Loading branch information...
1 parent 948248a commit d24914c2e8f38a018b4855d65008d07b8ba8bb5b @kulbirsaini kulbirsaini committed Sep 24, 2010
Showing with 10 additions and 10 deletions.
  1. +10 −10 railties/guides/source/association_basics.textile
View
20 railties/guides/source/association_basics.textile
@@ -1029,7 +1029,7 @@ When you declare a +has_many+ association, the declaring class automatically gai
* <tt><em>collection</em>.empty?</tt>
* <tt><em>collection</em>.size</tt>
* <tt><em>collection</em>.find(...)</tt>
-* <tt><em>collection</em>.where(:conditions)</tt>
+* <tt><em>collection</em>.where(...)</tt>
* <tt><em>collection</em>.exists?(...)</tt>
* <tt><em>collection</em>.build(attributes = {}, ...)</tt>
* <tt><em>collection</em>.create(attributes = {})</tt>
@@ -1055,7 +1055,7 @@ orders.clear
orders.empty?
orders.size
orders.find(...)
-orders.where(:conditions)
+orders.where(...)
orders.exists?(...)
orders.build(attributes = {}, ...)
orders.create(attributes = {})
@@ -1134,15 +1134,15 @@ The <tt><em>collection</em>.find</tt> method finds objects within the collection
@open_orders = @customer.orders.find(:all, :conditions => "open = 1")
</ruby>
-WARNING: Starting Rails 3, supplying options to +ActiveRecord::Base.find+ method is depricated. Use <tt><em>collection</em>.where</tt> instead when you need to pass conditions.
+NOTE: Starting Rails 3, supplying options to +ActiveRecord::Base.find+ method is discouraged. Use <tt><em>collection</em>.where</tt> instead when you need to pass conditions.
-h6(#has_many-collection-where). <tt><em>collection</em>.where(:conditions)</tt>
+h6(#has_many-collection-where). <tt><em>collection</em>.where(...)</tt>
The <tt><em>collection</em>.where</tt> method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed.
<ruby>
-@open_orders = @customer.orders.where(:open => 1) # No query yet
-@open_order = @open_orders.first # Now the database will queried
+@open_orders = @customer.orders.where(:open => true) # No query yet
+@open_order = @open_orders.first # Now the database will be queried
</ruby>
h6(#has_many-collection-exists). <tt><em>collection</em>.exists?(...)</tt>
@@ -1452,7 +1452,7 @@ When you declare a +has_and_belongs_to_many+ association, the declaring class au
* <tt><em>collection</em>.empty?</tt>
* <tt><em>collection</em>.size</tt>
* <tt><em>collection</em>.find(...)</tt>
-* <tt><em>collection</em>.where(:conditions)</tt>
+* <tt><em>collection</em>.where(...)</tt>
* <tt><em>collection</em>.exists?(...)</tt>
* <tt><em>collection</em>.build(attributes = {})</tt>
* <tt><em>collection</em>.create(attributes = {})</tt>
@@ -1478,7 +1478,7 @@ assemblies.clear
assemblies.empty?
assemblies.size
assemblies.find(...)
-assemblies.where(:conditions)
+assemblies.where(...)
assemblies.exists?(...)
assemblies.build(attributes = {}, ...)
assemblies.create(attributes = {})
@@ -1564,9 +1564,9 @@ The <tt><em>collection</em>.find</tt> method finds objects within the collection
:conditions => ["created_at > ?", 2.days.ago])
</ruby>
-WARNING: Starting Rails 3, supplying options to +ActiveRecord::Base.find+ method is depricated. Use <tt><em>collection</em>.where</tt> instead when you need to pass conditions.
+NOTE: Starting Rails 3, supplying options to +ActiveRecord::Base.find+ method is discouraged. Use <tt><em>collection</em>.where</tt> instead when you need to pass conditions.
-h6(#has_and_belongs_to_many-collection-where). <tt><em>collection</em>.where(:conditions)</tt>
+h6(#has_and_belongs_to_many-collection-where). <tt><em>collection</em>.where(...)</tt>
The <tt><em>collection</em>.where</tt> method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed. It also adds the additional condition that the object must be in the collection.

0 comments on commit d24914c

Please sign in to comment.
Something went wrong with that request. Please try again.