Class: FloorType
Overview
== Schema Information
Table name: floor_types
Database name: primary
id :integer not null, primary key
design_tool_name :string(255)
environment :string(50)
ev2_inset :integer
is_active :boolean default(TRUE), not null
name :string(80) not null
product :string(12) not null
seo_key :string
Indexes
index_floor_types_on_name (name)
index_floor_types_on_seo_key (seo_key)
Constant Summary
Constants included
from Schedulable
Schedulable::SIMPLE_FORM_OPTIONS
Has and belongs to many
collapse
Class Method Summary
collapse
Instance Method Summary
collapse
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
config
#after_commit
#publish_event
Class Method Details
.active ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are active. Active Record Scope
49
|
# File 'app/models/floor_type.rb', line 49
scope :active, -> { where(is_active: true).by_name }
|
.by_environment ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are by environment. Active Record Scope
50
|
# File 'app/models/floor_type.rb', line 50
scope :by_environment, ->(ev) { where(environment: ev).by_name }
|
.by_name ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are by name. Active Record Scope
48
|
# File 'app/models/floor_type.rb', line 48
scope :by_name, -> { order("floor_types.name") }
|
.floating ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are floating. Active Record Scope
51
|
# File 'app/models/floor_type.rb', line 51
scope :floating, -> { where("floor_types.name ILIKE '%floating%'") }
|
.indoor ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are indoor. Active Record Scope
54
|
# File 'app/models/floor_type.rb', line 54
scope :indoor, -> { by_environment('Indoor') }
|
.indoors ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are indoors. Active Record Scope
52
|
# File 'app/models/floor_type.rb', line 52
scope :indoors, -> { by_environment('Indoor') }
|
.options_for_select(zev = false, store_id = 1) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'app/models/floor_type.rb', line 61
def self.options_for_select(zev = false, store_id = 1)
options = if zev.present?
active.by_environment(zev)
else
active
end
options.select { |ft| ft.store_ids.include?(store_id) }.map { |f| [f.name.to_s, f.id] }
end
|
.outdoor ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are outdoor. Active Record Scope
55
|
# File 'app/models/floor_type.rb', line 55
scope :outdoor, -> { by_environment('Outdoor') }
|
.outdoors ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are outdoors. Active Record Scope
53
|
# File 'app/models/floor_type.rb', line 53
scope :outdoors, -> { by_environment('Outdoor') }
|
Instance Method Details
#adjust_area_factor ⇒ Object
102
103
104
105
106
107
108
|
# File 'app/models/floor_type.rb', line 102
def adjust_area_factor
factor = 1.0
factor = 0.9 if is_nailed?
factor
end
|
#heating_element_product_line_options ⇒ ActiveRecord::Relation<HeatingElementProductLineOption>
45
|
# File 'app/models/floor_type.rb', line 45
has_many :heating_element_product_line_options, inverse_of: :floor_type
|
#is_carpet? ⇒ Boolean
74
75
76
|
# File 'app/models/floor_type.rb', line 74
def is_carpet?
name.to_s.downcase.index('carpet').present?
end
|
#is_copper? ⇒ Boolean
119
120
121
|
# File 'app/models/floor_type.rb', line 119
def is_copper?
name.downcase.index("copper").present?
end
|
#is_engineered? ⇒ Boolean
82
83
84
|
# File 'app/models/floor_type.rb', line 82
def is_engineered?
name.to_s.downcase.index('engineered').present?
end
|
#is_floating? ⇒ Boolean
70
71
72
|
# File 'app/models/floor_type.rb', line 70
def is_floating?
name.to_s.downcase.index('float').present?
end
|
#is_indoors? ⇒ Boolean
94
95
96
|
# File 'app/models/floor_type.rb', line 94
def is_indoors?
environment.to_s.downcase.index('indoor').present?
end
|
#is_laminate? ⇒ Boolean
78
79
80
|
# File 'app/models/floor_type.rb', line 78
def is_laminate?
name.to_s.downcase.index('laminate').present?
end
|
#is_nailed? ⇒ Boolean
110
111
112
113
|
# File 'app/models/floor_type.rb', line 110
def is_nailed?
name.downcase.index("nailed").present?
end
|
#is_outdoors? ⇒ Boolean
98
99
100
|
# File 'app/models/floor_type.rb', line 98
def is_outdoors?
environment.to_s.downcase.index('outdoor').present?
end
|
#is_slate_shingle? ⇒ Boolean
115
116
117
|
# File 'app/models/floor_type.rb', line 115
def is_slate_shingle?
name.downcase.index("slate shingle").present?
end
|
#is_temperature_limited? ⇒ Boolean
90
91
92
|
# File 'app/models/floor_type.rb', line 90
def is_temperature_limited?
is_carpet? or is_laminate? or is_engineered? or is_vinyl?
end
|
#is_vinyl? ⇒ Boolean
86
87
88
|
# File 'app/models/floor_type.rb', line 86
def is_vinyl?
name.to_s.downcase.index('vinyl').present?
end
|
#is_wood_shake? ⇒ Boolean
123
124
125
|
# File 'app/models/floor_type.rb', line 123
def is_wood_shake?
name.downcase.index("wood shake").present?
end
|
#require_expansion_joint?(room_type_id = nil) ⇒ Boolean
#room_configurations ⇒ ActiveRecord::Relation<RoomConfiguration>
43
|
# File 'app/models/floor_type.rb', line 43
has_many :room_configurations
|
#showcases ⇒ ActiveRecord::Relation<Showcase>
44
|
# File 'app/models/floor_type.rb', line 44
has_many :showcases
|
#stores ⇒ ActiveRecord::Relation<Store>
42
|
# File 'app/models/floor_type.rb', line 42
has_and_belongs_to_many :stores
|
#sub_floor_types ⇒ ActiveRecord::Relation<SubFloorType>
46
|
# File 'app/models/floor_type.rb', line 46
has_many :sub_floor_types, through: :heating_element_product_line_options
|