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)
Has and belongs to many
collapse
Class Method Summary
collapse
Instance Method Summary
collapse
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
#publish_event
Class Method Details
.active ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are active. Active Record Scope
50
|
# File 'app/models/floor_type.rb', line 50
scope :active, -> { where(:is_active => true).by_name }
|
.by_environment ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are by environment. Active Record Scope
51
|
# File 'app/models/floor_type.rb', line 51
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
49
|
# File 'app/models/floor_type.rb', line 49
scope :by_name, -> { order("floor_types.name") }
|
.floating ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are floating. Active Record Scope
52
|
# File 'app/models/floor_type.rb', line 52
scope :floating, -> { where("floor_types.name ILIKE '%floating%'") }
|
.indoor ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are indoor. Active Record Scope
55
|
# File 'app/models/floor_type.rb', line 55
scope :indoor, -> { by_environment('Indoor') }
|
.indoors ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are indoors. Active Record Scope
53
|
# File 'app/models/floor_type.rb', line 53
scope :indoors, -> { by_environment('Indoor') }
|
.options_for_select(zev = false, store_id = 1) ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'app/models/floor_type.rb', line 62
def self.options_for_select(zev=false, store_id=1)
if zev.present?
options = self.active.by_environment(zev)
else
options = self.active
end
return options.select{|ft| ft.store_ids.include?(store_id)}.map {|f| ["#{f.name}", f.id]}
end
|
.outdoor ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are outdoor. Active Record Scope
56
|
# File 'app/models/floor_type.rb', line 56
scope :outdoor, -> { by_environment('Outdoor') }
|
.outdoors ⇒ ActiveRecord::Relation<FloorType>
A relation of FloorTypes that are outdoors. Active Record Scope
54
|
# File 'app/models/floor_type.rb', line 54
scope :outdoors, -> { by_environment('Outdoor') }
|
Instance Method Details
#adjust_area_factor ⇒ Object
103
104
105
106
107
108
109
|
# File 'app/models/floor_type.rb', line 103
def adjust_area_factor
factor = 1.0
factor = 0.9 if self.is_nailed?
return factor
end
|
#heating_element_product_line_options ⇒ ActiveRecord::Relation<HeatingElementProductLineOption>
46
|
# File 'app/models/floor_type.rb', line 46
has_many :heating_element_product_line_options, :inverse_of => :floor_type
|
#is_carpet? ⇒ Boolean
75
76
77
|
# File 'app/models/floor_type.rb', line 75
def is_carpet?
self.name.to_s.downcase.index('carpet').present?
end
|
#is_copper? ⇒ Boolean
120
121
122
|
# File 'app/models/floor_type.rb', line 120
def is_copper?
self.name.downcase.index("copper").present?
end
|
#is_engineered? ⇒ Boolean
83
84
85
|
# File 'app/models/floor_type.rb', line 83
def is_engineered?
self.name.to_s.downcase.index('engineered').present?
end
|
#is_floating? ⇒ Boolean
71
72
73
|
# File 'app/models/floor_type.rb', line 71
def is_floating?
self.name.to_s.downcase.index('float').present?
end
|
#is_indoors? ⇒ Boolean
95
96
97
|
# File 'app/models/floor_type.rb', line 95
def is_indoors?
self.environment.to_s.downcase.index('indoor').present?
end
|
#is_laminate? ⇒ Boolean
79
80
81
|
# File 'app/models/floor_type.rb', line 79
def is_laminate?
self.name.to_s.downcase.index('laminate').present?
end
|
#is_nailed? ⇒ Boolean
111
112
113
114
|
# File 'app/models/floor_type.rb', line 111
def is_nailed?
self.name.downcase.index("nailed").present?
end
|
#is_outdoors? ⇒ Boolean
99
100
101
|
# File 'app/models/floor_type.rb', line 99
def is_outdoors?
self.environment.to_s.downcase.index('outdoor').present?
end
|
#is_slate_shingle? ⇒ Boolean
116
117
118
|
# File 'app/models/floor_type.rb', line 116
def is_slate_shingle?
self.name.downcase.index("slate shingle").present?
end
|
#is_temperature_limited? ⇒ Boolean
91
92
93
|
# File 'app/models/floor_type.rb', line 91
def is_temperature_limited?
self.is_carpet? or self.is_laminate? or self.is_engineered? or self.is_vinyl?
end
|
#is_vinyl? ⇒ Boolean
87
88
89
|
# File 'app/models/floor_type.rb', line 87
def is_vinyl?
self.name.to_s.downcase.index('vinyl').present?
end
|
#is_wood_shake? ⇒ Boolean
124
125
126
|
# File 'app/models/floor_type.rb', line 124
def is_wood_shake?
self.name.downcase.index("wood shake").present?
end
|
#require_expansion_joint?(room_type_id = nil) ⇒ Boolean
#room_configurations ⇒ ActiveRecord::Relation<RoomConfiguration>
44
|
# File 'app/models/floor_type.rb', line 44
has_many :room_configurations
|
#showcases ⇒ ActiveRecord::Relation<Showcase>
45
|
# File 'app/models/floor_type.rb', line 45
has_many :showcases
|
#stores ⇒ ActiveRecord::Relation<Store>
43
|
# File 'app/models/floor_type.rb', line 43
has_and_belongs_to_many :stores
|
#sub_floor_types ⇒ ActiveRecord::Relation<SubFloorType>
47
|
# File 'app/models/floor_type.rb', line 47
has_many :sub_floor_types, :through => :heating_element_product_line_options
|