Module: Reputation::User::AddRails3
- Defined in:
- lib/reputation/user.rb
Instance Method Summary collapse
Instance Method Details
#add(rule, metric) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/reputation/user.rb', line 32 def add(rule, metric) rule = ReputationRule.find_by_name rule unless rule.is_a? ReputationRule b = proxy_association.reflection.klass.find_by_user_id_and_rule_id proxy_association.owner.id, rule.id b ||= proxy_association.reflection.klass.new :rule => rule, :user => proxy_association.owner b.update_attribute :metric, metric proxy_association.owner.behaviours(true) b end |