module ActiveSchema::API

Public Class Methods

included(base) click to toggle source
# File lib/active_schema/api.rb, line 4
def self.included base
  base.extend(self)
end

Public Instance Methods

schema(opts = {}) click to toggle source
# File lib/active_schema/api.rb, line 8
def schema opts = {}, &schema
  opts = Hash[opts] # somehow i do not like #dup in this context...
  table = opts.delete(:table) || self.table_name
  connection = opts.delete(:connection) || ActiveRecord::Base.connection
  ActiveSchema::SCHEMAS[table.to_s] = [connection, opts, schema]
end