class PraiseTreadCache < ActiveRecord::Base attr_accessible :object_id,:object_type,:praise_num,:tread_num def plus(num) self.update_attribute(:praise_num, self.praise_num.to_i + num) end def minus(num) self.update_attribute(:praise_num, self.praise_num.to_i - num) end end