Module: Reputation::User::AddRails2
- Defined in:
- lib/reputation/user.rb
Instance Method Summary collapse
Instance Method Details
#add(rule, metric) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/reputation/user.rb', line 21 def add(rule, metric) rule = ReputationRule.find_by_name rule unless rule.is_a? ReputationRule b = proxy_reflection.klass.find_by_user_id_and_rule_id proxy_owner.id, rule.id b ||= proxy_reflection.klass.new :rule => rule, :user => proxy_owner b.update_attribute :metric, metric proxy_owner.behaviours(true) b end |