提交 3a7a021e 编写于 作者: K Kasper Timm Hansen

Merge pull request #23605 from y-yagi/remove_warnings_in_finder_methods

remove warnings from FinderMethods
...@@ -249,13 +249,13 @@ def forty_two! ...@@ -249,13 +249,13 @@ def forty_two!
# Person.offset(3).third_to_last # returns the third-to-last object from OFFSET 3 # 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 # Person.where(["user_name = :u", { u: user_name }]).third_to_last
def third_to_last def third_to_last
find_nth -3 find_nth(-3)
end end
# Same as #third_to_last but raises ActiveRecord::RecordNotFound if no record # Same as #third_to_last but raises ActiveRecord::RecordNotFound if no record
# is found. # is found.
def third_to_last! def third_to_last!
find_nth! -3 find_nth!(-3)
end end
# Find the second-to-last record. # Find the second-to-last record.
...@@ -265,13 +265,13 @@ def third_to_last! ...@@ -265,13 +265,13 @@ def third_to_last!
# Person.offset(3).second_to_last # returns the second-to-last object from OFFSET 3 # 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 # Person.where(["user_name = :u", { u: user_name }]).second_to_last
def second_to_last def second_to_last
find_nth -2 find_nth(-2)
end end
# Same as #second_to_last but raises ActiveRecord::RecordNotFound if no record # Same as #second_to_last but raises ActiveRecord::RecordNotFound if no record
# is found. # is found.
def second_to_last! def second_to_last!
find_nth! -2 find_nth!(-2)
end end
# Returns true if a record exists in the table that matches the +id+ or # Returns true if a record exists in the table that matches the +id+ or
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册