Class: BlocRecord::Base

Inherits:
Object
  • Object
show all
Extended by:
Associations, Connection, Schema, Selection
Includes:
Persistence
Defined in:
lib/bloc_record/base.rb

Instance Method Summary collapse

Methods included from Selection

all, find, find_by, find_one, first, group, group_by_ids, join, last, limit, order, select, take, take_one, where

Methods included from Schema

attributes, columns, count, schema, table

Methods included from Connection

connection

Methods included from Associations

belongs_to, has_many

Methods included from Persistence

#destroy, included, #save, #save!, #update_attribute, #update_attributes

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



17
18
19
20
21
22
23
24
# File 'lib/bloc_record/base.rb', line 17

def initialize(options={})
  options = BlocRecord::Utility.convert_keys(options)

  self.class.columns.each do |col|
    self.class.send(:attr_accessor, col)
    self.instance_variable_set("@#{col}", options[col])
  end
end