Class: Color

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

Overview

Schema Information

Table name: colors

id    :integer          not null, primary key
label :string

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) blue



10
11
12
# File 'app/models/color.rb', line 10

def self.blue
  find_by! label: 'Blue'
end

+ (Object) green



14
15
16
# File 'app/models/color.rb', line 14

def self.green
  find_by! label: 'Green'
end

+ (Object) orange



30
31
32
# File 'app/models/color.rb', line 30

def self.orange
  find_by! label: 'Orange'
end

+ (Object) purple



26
27
28
# File 'app/models/color.rb', line 26

def self.purple
  find_by! label: 'Purple'
end

+ (Object) red



22
23
24
# File 'app/models/color.rb', line 22

def self.red
  find_by! label: 'Red'
end

+ (Object) yellow



18
19
20
# File 'app/models/color.rb', line 18

def self.yellow
  find_by! label: 'Yellow'
end

Instance Method Details

- (Object) slug



34
35
36
# File 'app/models/color.rb', line 34

def slug
  label.underscore.dasherize.parameterize
end