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
Constants included from Models::Schedulable
Models::Schedulable::SIMPLE_FORM_OPTIONS
Instance Attribute Summary collapse
- #area ⇒ Float 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 ⇒ void protected
- #heat_loss_children ⇒ Array<Window, Door>
- #heat_loss_name ⇒ String
- #name ⇒ String
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::Schedulable
Methods included from Models::AfterCommittable
Methods included from Models::EventPublishable
Instance Attribute Details
#area ⇒ Float (readonly)
50 |
# File 'app/models/exterior_wall.rb', line 50 validates :area, numericality: { less_than_or_equal_to: 9999.9, greater_than: 0.0 } |
Instance Method Details
#check_insulation_or_u_value ⇒ void (protected)
This method returns an undefined value.
78 79 80 81 82 83 |
# File 'app/models/exterior_wall.rb', line 78 def check_insulation_or_u_value return unless user_u_value.blank? && (exterior_wall_type.nil? || exterior_wall_insulation_type.nil?) errors.add(:exterior_wall_type_id, "and insulation type required OR") errors.add(:user_u_value, "required") end |
#doors ⇒ ActiveRecord::Relation<Door>
40 |
# File 'app/models/exterior_wall.rb', line 40 has_many :doors, -> { order("doors.id ASC NULLS LAST") }, dependent: :destroy |
#exterior_wall_insulation_type ⇒ ExteriorWallInsulationType?
46 |
# File 'app/models/exterior_wall.rb', line 46 belongs_to :exterior_wall_insulation_type, optional: true |
#exterior_wall_type ⇒ ExteriorWallType?
44 |
# File 'app/models/exterior_wall.rb', line 44 belongs_to :exterior_wall_type, optional: true |
#heat_loss_children ⇒ Array<Window, Door>
57 58 59 |
# File 'app/models/exterior_wall.rb', line 57 def heat_loss_children windows + doors end |
#heat_loss_name ⇒ String
71 72 73 |
# File 'app/models/exterior_wall.rb', line 71 def heat_loss_name name end |
#name ⇒ String
62 63 64 65 66 67 68 |
# File 'app/models/exterior_wall.rb', line 62 def name "Exterior Wall: #{begin (room_configuration.exterior_wall_ids.index(id) + 1) rescue StandardError 'New' end}" end |
#room_configuration ⇒ RoomConfiguration?
Validations:
42 |
# File 'app/models/exterior_wall.rb', line 42 belongs_to :room_configuration, optional: true |
#windows ⇒ ActiveRecord::Relation<Window>
38 |
# File 'app/models/exterior_wall.rb', line 38 has_many :windows, -> { order("windows.id ASC NULLS LAST") }, dependent: :destroy |