Class: Emotion

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

Overview

Participants rate their emotions a name and intensity

Class Method Summary collapse

Class Method Details

.associate(participant, name) ⇒ Object



14
15
16
17
18
19
# File 'app/models/emotion.rb', line 14

def self.associate(participant, name)
  find_or_create_by(
    creator_id: participant.id,
    name: normalized_name(name)
  )
end

.normalized_name(n) ⇒ Object



21
22
23
# File 'app/models/emotion.rb', line 21

def self.normalized_name(n)
  n.strip.downcase
end