Class: ExteriorWallInsulationType
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ExteriorWallInsulationType
- Defined in:
- app/models/exterior_wall_insulation_type.rb
Overview
== Schema Information
Table name: exterior_wall_insulation_types
Database name: primary
id :integer not null, primary key
name :string(255)
u_value :float
exterior_wall_type_id :integer
Indexes
exterior_wall_insulation_types_exterior_wall_type_id_idx (exterior_wall_type_id)
Foreign Keys
exterior_wall_insulation_types_exterior_wall_type_id_fk (exterior_wall_type_id => exterior_wall_types.id)
Belongs to collapse
Class Method Summary collapse
-
.by_exterior_wall_type_id ⇒ ActiveRecord::Relation<ExteriorWallInsulationType>
A relation of ExteriorWallInsulationTypes that are by exterior wall type id.
-
.by_u_value ⇒ ActiveRecord::Relation<ExteriorWallInsulationType>
A relation of ExteriorWallInsulationTypes that are by u value.
- .options_for_select(exterior_wall_type_id, rc) ⇒ Object
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.by_exterior_wall_type_id ⇒ ActiveRecord::Relation<ExteriorWallInsulationType>
A relation of ExteriorWallInsulationTypes that are by exterior wall type id. Active Record Scope
24 |
# File 'app/models/exterior_wall_insulation_type.rb', line 24 scope :by_exterior_wall_type_id, ->(id) { where(:exterior_wall_type_id => id) } |
.by_u_value ⇒ ActiveRecord::Relation<ExteriorWallInsulationType>
A relation of ExteriorWallInsulationTypes that are by u value. Active Record Scope
23 |
# File 'app/models/exterior_wall_insulation_type.rb', line 23 scope :by_u_value, -> { order("exterior_wall_insulation_types.u_value DESC") } |
.options_for_select(exterior_wall_type_id, rc) ⇒ Object
26 27 28 29 30 |
# File 'app/models/exterior_wall_insulation_type.rb', line 26 def self.(exterior_wall_type_id, rc) res = ExteriorWallInsulationType.by_exterior_wall_type_id(exterior_wall_type_id).map{|o| [o.name.titleize, o.id]} res = [["Please Choose Exterior Wall Type", nil]] if res.empty? return res end |
Instance Method Details
#exterior_wall_type ⇒ ExteriorWallType
21 |
# File 'app/models/exterior_wall_insulation_type.rb', line 21 belongs_to :exterior_wall_type, optional: true |