Class: CeilingInsulationType
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- CeilingInsulationType
- Includes:
- Models::Auditable
- Defined in:
- app/models/ceiling_insulation_type.rb
Overview
== Schema Information
Table name: ceiling_insulation_types
Database name: primary
id :integer not null, primary key
name :string(255)
u_value :float
ceiling_type_id :integer
Indexes
ceiling_insulation_types_ceiling_type_id_idx (ceiling_type_id)
Foreign Keys
ceiling_insulation_types_ceiling_type_id_fk (ceiling_type_id => ceiling_types.id)
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Belongs to collapse
Methods included from Models::Auditable
Class Method Summary collapse
-
.by_ceiling_type_id ⇒ ActiveRecord::Relation<CeilingInsulationType>
A relation of CeilingInsulationTypes that are by ceiling type id.
-
.by_u_value ⇒ ActiveRecord::Relation<CeilingInsulationType>
A relation of CeilingInsulationTypes that are by u value.
- .options_for_select(ceiling_type_id, rc) ⇒ Object
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.by_ceiling_type_id ⇒ ActiveRecord::Relation<CeilingInsulationType>
A relation of CeilingInsulationTypes that are by ceiling type id. Active Record Scope
26 |
# File 'app/models/ceiling_insulation_type.rb', line 26 scope :by_ceiling_type_id, ->(id) { where(:ceiling_type_id => id) } |
.by_u_value ⇒ ActiveRecord::Relation<CeilingInsulationType>
A relation of CeilingInsulationTypes that are by u value. Active Record Scope
25 |
# File 'app/models/ceiling_insulation_type.rb', line 25 scope :by_u_value, -> { order("ceiling_insulation_types.u_value DESC") } |
.options_for_select(ceiling_type_id, rc) ⇒ Object
28 29 30 31 32 |
# File 'app/models/ceiling_insulation_type.rb', line 28 def self.(ceiling_type_id, rc) res = CeilingInsulationType.by_ceiling_type_id(ceiling_type_id).map{|o| [o.name.titleize, o.id]} res = [["Please Choose What's Over The Ceiling", nil]] if res.empty? return res end |
Instance Method Details
#ceiling_type ⇒ CeilingType
23 |
# File 'app/models/ceiling_insulation_type.rb', line 23 belongs_to :ceiling_type, optional: true |