diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_record_querying.textile | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 8eb28ec953..b4db365a09 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -457,6 +457,17 @@ Post.where(Post.arel_table[:comments_count].gteq_all([1,2])) This method's opposite is +lteq_all+. +h4. +or+ + +Allows you to chain queries to get results matching either condition: + +<ruby> +title = Post.arel_table[:title] +Post.where(title.eq("Active").or(title.eq("Record"))) +</ruby> + +Note that this method is called on the end of the +eq+ method here, rather than the +where+. + h3. Ordering To retrieve records from the database in a specific order, you can use the +order+ method. |