Class: Hubstats::Label

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

Class Method Summary collapse

Class Method Details

.first_or_create(label) ⇒ Object



20
21
22
23
24
25
26
# File 'app/models/hubstats/label.rb', line 20

def self.first_or_create(label)
  if exists = Hubstats::Label.where(name: label[:name]).first
    return exists
  else
    Label.new(name: label[:name], url: label[:url], color: label[:color])
  end
end