diff options
author | Arthur Nogueira Neves <github@arthurnn.com> | 2016-03-14 11:12:10 -0400 |
---|---|---|
committer | Arthur Nogueira Neves <github@arthurnn.com> | 2016-03-14 11:12:10 -0400 |
commit | 043ce5c33e780bbf53a6fa3469173fbbb3f45a83 (patch) | |
tree | bd617d09fdc2d07cfc1a7cc2fe5f8771ee062afd | |
parent | 493297d13f7d010a896b6cb026c874f64d959ba5 (diff) | |
parent | 8f3427125018f59392dc876a8195ee2f54d2b51d (diff) | |
download | rails-043ce5c33e780bbf53a6fa3469173fbbb3f45a83.tar.gz rails-043ce5c33e780bbf53a6fa3469173fbbb3f45a83.tar.bz2 rails-043ce5c33e780bbf53a6fa3469173fbbb3f45a83.zip |
Merge pull request #24187 from akihiro17/fix-find-doc
[ci skip] Fix the FinderMethods#find document
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index c3053f0b13..27dd0b4143 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -42,10 +42,10 @@ module ActiveRecord # Person.find_by(name: 'Spartacus', rating: 4) # # returns the first item or nil. # - # Person.where(name: 'Spartacus', rating: 4).first_or_initialize + # Person.find_or_initialize_by(name: 'Spartacus', rating: 4) # # returns the first item or returns a new instance (requires you call .save to persist against the database). # - # Person.where(name: 'Spartacus', rating: 4).first_or_create + # Person.find_or_create_by(name: 'Spartacus', rating: 4) # # returns the first item or creates it and returns it. # # ==== Alternatives for #find |