aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/association_basics.textile
diff options
context:
space:
mode:
authorKulbir Saini <kulbirsaini25@gmail.com>2010-09-24 04:27:51 +0530
committerKulbir Saini <kulbirsaini25@gmail.com>2010-09-24 04:27:51 +0530
commitd24914c2e8f38a018b4855d65008d07b8ba8bb5b (patch)
tree3fc132cc38b882be2387ba671652f3ea76e540fc /railties/guides/source/association_basics.textile
parent948248a23d1e60dcb73af7db6d3eb7c70ccd4a72 (diff)
downloadrails-d24914c2e8f38a018b4855d65008d07b8ba8bb5b.tar.gz
rails-d24914c2e8f38a018b4855d65008d07b8ba8bb5b.tar.bz2
rails-d24914c2e8f38a018b4855d65008d07b8ba8bb5b.zip
Fixes in associations_basics guide.
Diffstat (limited to 'railties/guides/source/association_basics.textile')
-rw-r--r--railties/guides/source/association_basics.textile20
1 files changed, 10 insertions, 10 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile
index 3bf1c6295d..6996dab8c5 100644
--- a/railties/guides/source/association_basics.textile
+++ b/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.