class Pledge < ActiveRecord::Base
belongs_to :user
validates :amount, :presence => true, :numericality => {:greater_than => 0}
validates :divisor, :presence => true, :numericality => {:greater_than => 0}
validates_presence_of :user_id
before_save :set_pay_this
after_save :set_pennies
def set_pay_this
self.pay_this = self.amount/self.divisor
end
def set_pennies
self.pennies = self.pay_this * 100
end
end
beforesaveが、これはうまく動作しますが、設定されたペニーはpledge.saveなぜこのafter_saveは機能しませんか?