diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2008-10-31 11:15:12 +1030 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2008-10-31 11:15:12 +1030 |
commit | 3b2b77baaef3c8b9a8794f4c37916adf27a4d63e (patch) | |
tree | c20f051d0857bf2650e034d806757aa2702254c0 | |
parent | 08d81fdc5c59ee2aedb372faa00a9cb067621d4b (diff) | |
download | rails-3b2b77baaef3c8b9a8794f4c37916adf27a4d63e.tar.gz rails-3b2b77baaef3c8b9a8794f4c37916adf27a4d63e.tar.bz2 rails-3b2b77baaef3c8b9a8794f4c37916adf27a4d63e.zip |
Removed extra space from the array conditions section.
-rw-r--r-- | railties/doc/guides/source/finders.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/doc/guides/source/finders.txt b/railties/doc/guides/source/finders.txt index 945b527e1d..2e6b368e3f 100644 --- a/railties/doc/guides/source/finders.txt +++ b/railties/doc/guides/source/finders.txt @@ -134,7 +134,7 @@ If you'd like to add conditions to your find, you could just specify them in the === Array Conditions === - Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like +Client.first(:conditions => ["orders_count = ?", params[:orders]])+. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like +Client.first(:conditions => ["orders_count = ? AND locked = ?", params[:orders], false])+. In this example, the first question mark will be replaced with the value in params orders and the second will be replaced with true and this will find the first record in the table that has '2' as its value for the orders_count field and 'false' for its locked field. +Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like +Client.first(:conditions => ["orders_count = ?", params[:orders]])+. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like +Client.first(:conditions => ["orders_count = ? AND locked = ?", params[:orders], false])+. In this example, the first question mark will be replaced with the value in params orders and the second will be replaced with true and this will find the first record in the table that has '2' as its value for the orders_count field and 'false' for its locked field. The reason for doing code like: |