aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_querying.textile
diff options
context:
space:
mode:
authorAldo "xoen" Giambelluca <xoen@xoen.org>2012-09-02 19:37:34 +0200
committerAldo "xoen" Giambelluca <xoen@xoen.org>2012-09-02 19:37:34 +0200
commit1b5e6fc291808579f2a9b0f45f9952e048085400 (patch)
tree573d97ba0ff683bbc1c174305e296de7f6750124 /guides/source/active_record_querying.textile
parentc38fe906c06993a641a9ec989e2bd9140b0c88c3 (diff)
downloadrails-1b5e6fc291808579f2a9b0f45f9952e048085400.tar.gz
rails-1b5e6fc291808579f2a9b0f45f9952e048085400.tar.bz2
rails-1b5e6fc291808579f2a9b0f45f9952e048085400.zip
Fixed validation issues related to taken IDs in AR Querying guide [ci skip]
Diffstat (limited to 'guides/source/active_record_querying.textile')
-rw-r--r--guides/source/active_record_querying.textile8
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/active_record_querying.textile b/guides/source/active_record_querying.textile
index 80c9260a0d..e211466339 100644
--- a/guides/source/active_record_querying.textile
+++ b/guides/source/active_record_querying.textile
@@ -266,7 +266,7 @@ SELECT * FROM clients WHERE (clients.id IN (1,10))
WARNING: <tt>Model.find(array_of_primary_key)</tt> will raise an +ActiveRecord::RecordNotFound+ exception unless a matching record is found for <strong>all</strong> of the supplied primary keys.
-h5. take
+h5(#take-n-objects). take
<tt>Model.take(limit)</tt> retrieves the first number of records specified by +limit+ without any explicit ordering:
@@ -282,7 +282,7 @@ The SQL equivalent of the above is:
SELECT * FROM clients LIMIT 2
</sql>
-h5. first
+h5(#first-n-objects). first
<tt>Model.first(limit)</tt> finds the first number of records specified by +limit+ ordered by primary key:
@@ -298,7 +298,7 @@ The SQL equivalent of the above is:
SELECT * FROM clients LIMIT 2
</sql>
-h5. last
+h5(#last-n-objects). last
<tt>Model.last(limit)</tt> finds the number of records specified by +limit+ ordered by primary key in descending order:
@@ -1218,7 +1218,7 @@ Client.find_or_create_by_first_name(:first_name => "Andy", :locked => false)
This method still works, but it's encouraged to use +first_or_create+ because it's more explicit on which arguments are used to _find_ the record and which are used to _create_, resulting in less confusion overall.
-h4. +first_or_create!+
+h4(#first_or_create_bang). +first_or_create!+
You can also use +first_or_create!+ to raise an exception if the new record is invalid. Validations are not covered on this guide, but let's assume for a moment that you temporarily add