aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2008-12-21 13:28:11 +1030
committerRyan Bigg <radarlistener@gmail.com>2008-12-21 13:28:11 +1030
commit199f4c54ea3139168a867b7f80ac789a3c29a48d (patch)
treea38688986913a356419ecad8d7912bc8cdd34b5a /railties
parent46702e6a6d26b66b67076129fcf9c59c1c27bbeb (diff)
downloadrails-199f4c54ea3139168a867b7f80ac789a3c29a48d.tar.gz
rails-199f4c54ea3139168a867b7f80ac789a3c29a48d.tar.bz2
rails-199f4c54ea3139168a867b7f80ac789a3c29a48d.zip
Added more to the hashn conditions section.
Diffstat (limited to 'railties')
-rw-r--r--railties/doc/guides/source/finders.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/doc/guides/source/finders.txt b/railties/doc/guides/source/finders.txt
index d2bd55ada7..0a16f178dc 100644
--- a/railties/doc/guides/source/finders.txt
+++ b/railties/doc/guides/source/finders.txt
@@ -267,7 +267,14 @@ You can also join in tables and specify their columns in the hash:
[source, ruby]
-------------------------------------------------------
-Client.all(:include => "orders", :conditions => { 'orders.created_at; => ((Time.now.midnight - 1.day)..Time.now.midnight})
+Client.all(:include => "orders", :conditions => { 'orders.created_at' => (Time.now.midnight - 1.day)..Time.now.midnight })
+-------------------------------------------------------
+
+An alternative and cleaner syntax to this is:
+
+[source, ruby]
+-------------------------------------------------------
+Client.all(:include => "orders", :conditions => { :orders => { :created_at => (Time.now.midnight - 1.day)..Time.now.midnight } })
-------------------------------------------------------
This will find all clients who have orders that were created yesterday.
@@ -711,6 +718,7 @@ Thanks to Mike Gunderloy for his tips on creating this guide.
http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16[Lighthouse ticket]
+* December 21 2008: Added more to the has conditions section.
* December 17 2008: Fixed up syntax errors.
* December 16 2008: Covered hash conditions that were introduced in Rails 2.2.2.
* December 1 2008: Added using an SQL function example to Selecting Certain Fields section as per http://rails.lighthouseapp.com/projects/16213/tickets/36-adding-an-example-for-using-distinct-to-ar-finders[this ticket]