Module: Scoreable::Generator::InstanceMethods

Defined in:
lib/scoreable/generator/active_record.rb

Instance Method Summary collapse

Instance Method Details

#itselfObject



71
72
73
# File 'lib/scoreable/generator/active_record.rb', line 71

def itself
  self
end

#log_score(score, action, receiver) ⇒ Object Also known as: log_#{Scoreable.score_term}_receiver



75
76
77
78
# File 'lib/scoreable/generator/active_record.rb', line 75

def  log_score(score,action,receiver)
  receiver = self.send receiver if [String,Symbol].include? receiver.class
  receiver.send(Scoreable.table_name).create! action: action, :"#{Scoreable.score_term}" => score, :"#{Scoreable.score_term}_generator" => self
end