Skip to content

Commit 7899461

Browse files
committed
[ci skip] fix association callback method without parameter in documentaion
1 parent 12f6ac0 commit 7899461

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/source/active_record_callbacks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ class Author < ApplicationRecord
983983
has_many :books, before_add: :check_limit
984984

985985
private
986-
def check_limit
986+
def check_limit(_book)
987987
if books.count >= 5
988988
errors.add(:base, "Cannot add more than 5 books for this author")
989989
throw(:abort)
@@ -1004,7 +1004,7 @@ callback for you to use.
10041004
class Author < ApplicationRecord
10051005
has_many :books, before_add: [:check_limit, :calculate_shipping_charges]
10061006

1007-
def check_limit
1007+
def check_limit(_book)
10081008
if books.count >= 5
10091009
errors.add(:base, "Cannot add more than 5 books for this author")
10101010
throw(:abort)

0 commit comments

Comments
 (0)