diff options
author | Ahmad Al-kheat <wisamfaithful@gmail.com> | 2015-01-12 16:50:17 -0500 |
---|---|---|
committer | Ahmad <wisamfaithful@gmail.com> | 2015-01-12 18:19:48 -0500 |
commit | edbc9468d54dba47ca10e1b53c5725d6bd6c50e5 (patch) | |
tree | 97c7c43aae428c1ad8e0d96c8b00883f8bebe0ac /guides/source | |
parent | 72570ea289ca96edbc074c3aadb2be2b214303af (diff) | |
download | rails-edbc9468d54dba47ca10e1b53c5725d6bd6c50e5.tar.gz rails-edbc9468d54dba47ca10e1b53c5725d6bd6c50e5.tar.bz2 rails-edbc9468d54dba47ca10e1b53c5725d6bd6c50e5.zip |
Updated active_record_querying.md
Added the SQL equivalent of the find_by method
Update active_record_querying.md
Update active_record_querying.md
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_record_querying.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index f8c64cbd0c..f7ea72b68d 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -257,6 +257,12 @@ It is equivalent to writing: Client.where(first_name: 'Lifo').take ``` +The SQL equivalent of the above is: + +```sql +SELECT * FROM clients WHERE (clients.first_name = 'Lifo') LIMIT 1 +``` + The `find_by!` method behaves exactly like `find_by`, except that it will raise `ActiveRecord::RecordNotFound` if no matching record is found. For example: ```ruby |