Class: ExteriorWall
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ExteriorWall
- Includes:
- Models::HeatLossable
- Defined in:
- app/models/exterior_wall.rb
Overview
== Schema Information
Table name: exterior_walls
Database name: primary
id :integer not null, primary key
area :float
user_u_value :float
exterior_wall_insulation_type_id :integer
exterior_wall_type_id :integer
room_configuration_id :integer
Indexes
exterior_walls_exterior_wall_insulation_type_id_idx (exterior_wall_insulation_type_id)
exterior_walls_exterior_wall_type_id_idx (exterior_wall_type_id)
exterior_walls_room_configuration_id_idx (room_configuration_id)
Foreign Keys
exterior_walls_exterior_wall_insulation_type_id_fk (exterior_wall_insulation_type_id => exterior_wall_insulation_types.id)
exterior_walls_exterior_wall_type_id_fk (exterior_wall_type_id => exterior_wall_types.id)
exterior_walls_room_configuration_id_fk (room_configuration_id => room_configurations.id) ON DELETE => cascade
Constant Summary
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
Has many collapse
Belongs to collapse
- #exterior_wall_insulation_type ⇒ ExteriorWallInsulationType
- #exterior_wall_type ⇒ ExteriorWallType
- #room_configuration ⇒ RoomConfiguration
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::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)
44 |
# File 'app/models/exterior_wall.rb', line 44 validates :area, :numericality => { :less_than_or_equal_to => 9999.9, :greater_than => 0.0 } |
Instance Method Details
#check_insulation_or_u_value ⇒ Object (protected)
64 65 66 67 68 69 |
# File 'app/models/exterior_wall.rb', line 64 def check_insulation_or_u_value if self.user_u_value.blank? and (self.exterior_wall_type.nil? or self.exterior_wall_insulation_type.nil?) errors.add(:exterior_wall_type_id, "and insulation type required OR") errors.add(:user_u_value, "required") end end |
#doors ⇒ ActiveRecord::Relation<Door>
38 |
# File 'app/models/exterior_wall.rb', line 38 has_many :doors, -> { order("doors.id ASC NULLS LAST") }, :dependent => :destroy |
#exterior_wall_insulation_type ⇒ ExteriorWallInsulationType
41 |
# File 'app/models/exterior_wall.rb', line 41 belongs_to :exterior_wall_insulation_type, optional: true |
#exterior_wall_type ⇒ ExteriorWallType
40 |
# File 'app/models/exterior_wall.rb', line 40 belongs_to :exterior_wall_type, optional: true |
#heat_loss_children ⇒ Object
50 51 52 |
# File 'app/models/exterior_wall.rb', line 50 def heat_loss_children windows + doors end |
#heat_loss_name ⇒ Object
58 59 60 |
# File 'app/models/exterior_wall.rb', line 58 def heat_loss_name name end |
#name ⇒ Object
54 55 56 |
# File 'app/models/exterior_wall.rb', line 54 def name "Exterior Wall: #{(self.room_configuration.exterior_wall_ids.index(self.id) + 1) rescue 'New'}" end |
#room_configuration ⇒ RoomConfiguration
39 |
# File 'app/models/exterior_wall.rb', line 39 belongs_to :room_configuration, optional: true |
#windows ⇒ ActiveRecord::Relation<Window>
37 |
# File 'app/models/exterior_wall.rb', line 37 has_many :windows, -> { order("windows.id ASC NULLS LAST") }, :dependent => :destroy |