Class: SubFloorType

Inherits:
ApplicationRecord show all
Defined in:
app/models/sub_floor_type.rb

Overview

== Schema Information

Table name: sub_floor_types
Database name: primary

id :integer not null, primary key
is_active :boolean default(TRUE), not null
name :string(255)
seo_key :string

Indexes

index_sub_floor_types_on_seo_key (seo_key)

Has many collapse

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.activeActiveRecord::Relation<SubFloorType>

A relation of SubFloorTypes that are active. Active Record Scope

Returns:

See Also:



39
# File 'app/models/sub_floor_type.rb', line 39

scope :active, -> { where(:is_active => true).by_name }

.by_nameActiveRecord::Relation<SubFloorType>

A relation of SubFloorTypes that are by name. Active Record Scope

Returns:

See Also:



38
# File 'app/models/sub_floor_type.rb', line 38

scope :by_name, -> { order("sub_floor_types.name DESC") }

.options_for_selectObject



41
42
43
# File 'app/models/sub_floor_type.rb', line 41

def self.options_for_select
  return self.active.by_name.map {|sf| ["#{sf.name}", sf.id]}
end

Instance Method Details

#floor_typesActiveRecord::Relation<FloorType>

Returns:

See Also:



36
# File 'app/models/sub_floor_type.rb', line 36

has_many :floor_types, :through => :heating_element_product_line_options

#heating_element_product_line_optionsActiveRecord::Relation<HeatingElementProductLineOption>

Returns:

See Also:



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

has_many :heating_element_product_line_options, :inverse_of => :sub_floor_type

#room_configurationsActiveRecord::Relation<RoomConfiguration>

Returns:

  • (ActiveRecord::Relation<RoomConfiguration>)

See Also:



33
# File 'app/models/sub_floor_type.rb', line 33

has_many :room_configurations

#showcasesActiveRecord::Relation<Showcase>

Returns:

See Also:



34
# File 'app/models/sub_floor_type.rb', line 34

has_many :showcases