Class: UnderFloor

Inherits:
ApplicationRecord show all
Includes:
Models::Auditable, Models::HeatLossable
Defined in:
app/models/under_floor.rb

Overview

== Schema Information

Table name: under_floors
Database name: primary

id :integer not null, primary key
area :float
user_u_value :float
room_configuration_id :integer
under_floor_insulation_type_id :integer
under_floor_type_id :integer

Indexes

under_floors_room_configuration_id_idx (room_configuration_id)
under_floors_under_floor_insulation_type_id_idx (under_floor_insulation_type_id)
under_floors_under_floor_type_id_idx (under_floor_type_id)

Foreign Keys

under_floors_room_configuration_id_fk (room_configuration_id => room_configurations.id) ON DELETE => cascade
under_floors_under_floor_insulation_type_id_fk (under_floor_insulation_type_id => under_floor_insulation_types.id)
under_floors_under_floor_type_id_fk (under_floor_type_id => under_floor_types.id)

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

Belongs to collapse

Methods included from Models::Auditable

#creator, #updater

Instance Method Summary collapse

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, #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

#publish_event

Instance Attribute Details

#areaObject (readonly)



35
# File 'app/models/under_floor.rb', line 35

validates :area, :numericality => { :less_than_or_equal_to => 9999.9, :greater_than => 0.0 }

Instance Method Details

#check_insulation_or_u_valueObject (protected)



48
49
50
51
52
53
# File 'app/models/under_floor.rb', line 48

def check_insulation_or_u_value
  if self.user_u_value.blank? and (self.under_floor_type.nil? or self.under_floor_insulation_type.nil?)
    errors.add(:under_floor_type_id, "and insulation type required OR")
    errors.add(:user_u_value, "required")
  end
end

#heat_loss_nameObject



42
43
44
# File 'app/models/under_floor.rb', line 42

def heat_loss_name
  self.name
end

#nameObject



38
39
40
# File 'app/models/under_floor.rb', line 38

def name
  "Under Floor"
end

#room_configurationRoomConfiguration

Returns:

  • (RoomConfiguration)

See Also:



30
# File 'app/models/under_floor.rb', line 30

belongs_to :room_configuration, optional: true

#under_floor_insulation_typeUnderFloorInsulationType



32
# File 'app/models/under_floor.rb', line 32

belongs_to :under_floor_insulation_type, optional: true

#under_floor_typeUnderFloorType



31
# File 'app/models/under_floor.rb', line 31

belongs_to :under_floor_type, optional: true