Permalink
Browse files

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>
  • Loading branch information...
1 parent 5f1e394 commit edd93a53fe9e4609f68cf0057d83ecd499bbf817 @joker1007 joker1007 committed Dec 3, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/callbacks.rb
@@ -128,7 +128,7 @@ module ActiveRecord
# record.credit_card_number = decrypt(record.credit_card_number)
# end
#
- # alias_method :after_find, :after_save
+ # alias_method :after_initialize, :after_save
#
# private
# def encrypt(value)
@@ -163,7 +163,7 @@ module ActiveRecord
# record.send("#{@attribute}=", decrypt(record.send("#{@attribute}")))
# end
#
- # alias_method :after_find, :after_save
+ # alias_method :after_initialize, :after_save
#
# private
# def encrypt(value)

0 comments on commit edd93a5

Please sign in to comment.