Fix ActiveRecord::Callbacks sample code [ci skip]
Callback caller class uses `after_initialize`, but Callback callee defines `after_find`. Current sample code causes following error. NoMethodError: undefined method `after_initialize' for #<EncryptionWrapper:0x007fe4931fa5c0>
This commit is contained in:
parent
5f1e394165
commit
edd93a53fe
@ -128,7 +128,7 @@ module ActiveRecord
|
|||||||
# record.credit_card_number = decrypt(record.credit_card_number)
|
# record.credit_card_number = decrypt(record.credit_card_number)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# alias_method :after_find, :after_save
|
# alias_method :after_initialize, :after_save
|
||||||
#
|
#
|
||||||
# private
|
# private
|
||||||
# def encrypt(value)
|
# def encrypt(value)
|
||||||
@ -163,7 +163,7 @@ module ActiveRecord
|
|||||||
# record.send("#{@attribute}=", decrypt(record.send("#{@attribute}")))
|
# record.send("#{@attribute}=", decrypt(record.send("#{@attribute}")))
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# alias_method :after_find, :after_save
|
# alias_method :after_initialize, :after_save
|
||||||
#
|
#
|
||||||
# private
|
# private
|
||||||
# def encrypt(value)
|
# def encrypt(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user