Class: ReputationBehaviour

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/reputation_behaviour.rb

Instance Method Summary collapse

Instance Method Details

#rule=(rule) ⇒ Object

Set the rule, can either be a ReputationRule or the name of the rule

Examples:

behaviour.rule = 'rule_1'
# or
behaviour.rule = ReputationRule.find(:first)


23
24
25
26
27
28
29
30
# File 'app/models/reputation_behaviour.rb', line 23

def rule=(rule)
  write_attribute :rule_id, case rule
  when ReputationRule
    rule.id
  else 
    ReputationRule.find_by_name( rule ).try(:id)
  end
end