Class: ActiveHouse::Model

Inherits:
Object
  • Object
show all
Extended by:
PlainModel::Modeling::Queryable
Includes:
Logging, ActiveHouse::Modeling::Attributes, ActiveHouse::Modeling::Connection, ActiveHouse::Modeling::Query, ActiveHouse::Modeling::Scope, ActiveModel::Model
Defined in:
lib/active_house/model.rb

Defined Under Namespace

Classes: Column

Class Method Summary collapse

Methods included from Logging

#logger

Methods included from ActiveHouse::Modeling::Attributes

#==, #[], #[]=, #as_json, #assign_attributes, #initialize, #method_missing, #respond_to_missing?, #to_h

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveHouse::Modeling::Attributes

Class Method Details

.column_namesObject



36
37
38
# File 'lib/active_house/model.rb', line 36

def column_names
  columns.map(&:name)
end

.columnsObject



30
31
32
33
34
# File 'lib/active_house/model.rb', line 30

def columns
  return @columns if defined?(@columns)

  @columns = attribute_types.keys.map { |name| Column.new(name.to_sym) }
end

.table_name(name) ⇒ Object



26
27
28
# File 'lib/active_house/model.rb', line 26

def table_name(name)
  self._table_name = name.to_s
end