diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-11 07:53:19 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-11 07:53:19 +0100 |
commit | 3a7a021ed936af50d436f419ac651203cfd072f6 (patch) | |
tree | bb6724b6a3ed3e31f892562607f039218ba4b012 | |
parent | 0912579b1cc2832d4a389a5021d9dc6727d16f77 (diff) | |
parent | 424b2019830ea4c08e86ba9ff9600aa23a54cb4f (diff) | |
download | rails-3a7a021ed936af50d436f419ac651203cfd072f6.tar.gz rails-3a7a021ed936af50d436f419ac651203cfd072f6.tar.bz2 rails-3a7a021ed936af50d436f419ac651203cfd072f6.zip |
Merge pull request #23605 from y-yagi/remove_warnings_in_finder_methods
remove warnings from FinderMethods
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 90a6a466fd..a4280c5f33 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -249,13 +249,13 @@ module ActiveRecord # Person.offset(3).third_to_last # returns the third-to-last object from OFFSET 3 # Person.where(["user_name = :u", { u: user_name }]).third_to_last def third_to_last - find_nth -3 + find_nth(-3) end # Same as #third_to_last but raises ActiveRecord::RecordNotFound if no record # is found. def third_to_last! - find_nth! -3 + find_nth!(-3) end # Find the second-to-last record. @@ -265,13 +265,13 @@ module ActiveRecord # Person.offset(3).second_to_last # returns the second-to-last object from OFFSET 3 # Person.where(["user_name = :u", { u: user_name }]).second_to_last def second_to_last - find_nth -2 + find_nth(-2) end # Same as #second_to_last but raises ActiveRecord::RecordNotFound if no record # is found. def second_to_last! - find_nth! -2 + find_nth!(-2) end # Returns true if a record exists in the table that matches the +id+ or |