Displaying 1 result from an estimated 1 matches for "increment_memb".
2007 Jul 21
3
unable to get "has_many :after_add" to work - need help
...9;'m doing wrong?  I''ve spent way too much
time on this
--------------------------------------------------------------------------------------
class Picture < ActiveRecord::Base
  has_many    :ratings, :after_add => :increment_rating, :after_remove
=> :decrement_rating
  def increment_members(rating)
    self.rating += rating.amount
    save!
  end
end
--------------------------------------------------------------------------------------
class Rating < ActiveRecord::Base
  belongs_to :picture
end
-----------------------------------------------------------------------------------...