diff options
author | Nicolas Hock Isaza <nhocki@gmail.com> | 2011-08-30 15:40:09 -0500 |
---|---|---|
committer | Andrés Mejía <andmej@gmail.com> | 2011-08-30 16:37:13 -0500 |
commit | ee822f257e2f3f3b571772f30ae3a8edd69538c3 (patch) | |
tree | 8533293be346bf8a253cfb2540aa0d7c01fad5cc /railties | |
parent | 84dad446c6a23a15f67b9d558e8039891a008bff (diff) | |
download | rails-ee822f257e2f3f3b571772f30ae3a8edd69538c3.tar.gz rails-ee822f257e2f3f3b571772f30ae3a8edd69538c3.tar.bz2 rails-ee822f257e2f3f3b571772f30ae3a8edd69538c3.zip |
Adding `first_or_new` documentation to the AR Querying guide.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_record_querying.textile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 37874c2ea1..54ce7a25ab 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -1069,7 +1069,7 @@ NOTE: Be sure to check the extensive *Active Record Validations and Callbacks Gu h4. +first_or_new+ -The +first_or_new+ method will work just like +first_or_create+ but it will not call +create+ but the +new+. This means that a new model instance will be created in memory but won't be saved to the database. Continuing with the +first_or_create+ example, we now want the client named 'Nick': +The +first_or_new+ method will work just like +first_or_create+ but it will not call +create+ but +new+. This means that a new model instance will be created in memory but won't be saved to the database. Continuing with the +first_or_create+ example, we now want the client named 'Nick': <ruby> nick = Client.where(:first_name => 'Nick').first_or_new(:locked => false) |