Class: Ceiling
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ceiling
- Includes:
- Models::Auditable, Models::HeatLossable
- Defined in:
- app/models/ceiling.rb
Overview
== Schema Information
Table name: ceilings
Database name: primary
id :integer not null, primary key
area :float
height :float
user_u_value :float
ceiling_insulation_type_id :integer
ceiling_type_id :integer
room_configuration_id :integer
Indexes
ceilings_ceiling_insulation_type_id_idx (ceiling_insulation_type_id)
ceilings_ceiling_type_id_idx (ceiling_type_id)
ceilings_room_configuration_id_idx (room_configuration_id)
Foreign Keys
ceilings_ceiling_insulation_type_id_fk (ceiling_insulation_type_id => ceiling_insulation_types.id)
ceilings_ceiling_type_id_fk (ceiling_type_id => ceiling_types.id)
ceilings_room_configuration_id_fk (room_configuration_id => room_configurations.id) ON DELETE => cascade
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Constants included from HeatLossableConstants
HeatLossableConstants::BTU_PER_HOUR_PER_WATT, HeatLossableConstants::HIGH_U_VALUE_THRESHOLD, HeatLossableConstants::HLC_PRIMARY_OK_THRESHOLD, HeatLossableConstants::INFILTRATION_AREA_FACTORS, HeatLossableConstants::INFILTRATION_FIREPLACE_FACTORS, HeatLossableConstants::INFILTRATION_SEALING_FACTORS, HeatLossableConstants::PIE_CHART_FLAG_COLORS, HeatLossableConstants::PIE_CHART_OK_COLORS
Instance Attribute Summary collapse
- #area ⇒ Object readonly
- #height ⇒ Object readonly
Has many collapse
Belongs to collapse
- #ceiling_insulation_type ⇒ CeilingInsulationType
- #ceiling_type ⇒ CeilingType
- #room_configuration ⇒ RoomConfiguration
Methods included from Models::Auditable
Instance Method Summary collapse
- #check_insulation_or_u_value ⇒ Object protected
- #heat_loss_children ⇒ Object
- #heat_loss_name ⇒ Object
- #name ⇒ Object
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods included from Models::HeatLossable
#children_heat_loss_recursive, #get_children_heat_loss, #get_heat_loss, #get_self_and_children_heat_loss, #get_u_value, #heat_loss_children_recursive, #insulation_type, #reset_room_last_heat_loss, #self_and_children_heat_loss_recursive
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#area ⇒ Object (readonly)
37 |
# File 'app/models/ceiling.rb', line 37 validates :area, :numericality => { :less_than_or_equal_to => 9999.9, :greater_than => 0.0 } |
#height ⇒ Object (readonly)
38 |
# File 'app/models/ceiling.rb', line 38 validates :height, :numericality => { :less_than_or_equal_to => 999.9, :greater_than => 0.0 } |
Instance Method Details
#ceiling_insulation_type ⇒ CeilingInsulationType
34 |
# File 'app/models/ceiling.rb', line 34 belongs_to :ceiling_insulation_type, optional: true |
#ceiling_type ⇒ CeilingType
33 |
# File 'app/models/ceiling.rb', line 33 belongs_to :ceiling_type, optional: true |
#check_insulation_or_u_value ⇒ Object (protected)
56 57 58 59 60 61 |
# File 'app/models/ceiling.rb', line 56 def check_insulation_or_u_value if self.user_u_value.blank? and (self.ceiling_type.nil? or self.ceiling_insulation_type.nil?) errors.add(:ceiling_type_id, "and insulation type required OR") errors.add(:user_u_value, "required") end end |
#heat_loss_children ⇒ Object
43 44 45 |
# File 'app/models/ceiling.rb', line 43 def heat_loss_children return self.skylights end |
#heat_loss_name ⇒ Object
51 52 53 |
# File 'app/models/ceiling.rb', line 51 def heat_loss_name self.name end |
#name ⇒ Object
47 48 49 |
# File 'app/models/ceiling.rb', line 47 def name "Ceiling" end |
#room_configuration ⇒ RoomConfiguration
32 |
# File 'app/models/ceiling.rb', line 32 belongs_to :room_configuration, optional: true |
#skylights ⇒ ActiveRecord::Relation<Skylight>
31 |
# File 'app/models/ceiling.rb', line 31 has_many :skylights, -> { order("skylights.id ASC NULLS LAST") }, :dependent => :destroy |