Sha256: cbec4c1ebafc331051941f5870abab10ff52fbc941e6ab204435471dd03e60d5

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

require 'orm_adapter/adapters/active_record'
module Schemata
  module Orm
    # This module contains some helpers and handle schema (migrations):
    #
    #   create_table :accounts do |t|
    #     t.menuable
    #     t.nameable
    #     t.addressable
    #     t.contactable
    #     t.timestamps
    #   end
    #
    #   
    module ActiveRecord
      module Schema
        include Schemata::Schema

        # Tell how to apply schema methods.
        def apply_schema(name, type, options={})
          column name, type.to_s.downcase.to_sym, options
        end
      end
    end
  end
end

ActiveRecord::ConnectionAdapters::Table.send :include, Schemata::Orm::ActiveRecord::Schema
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Schemata::Orm::ActiveRecord::Schema

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schemata-0.1.0 lib/schemata/orm/active_record.rb
schemata-0.0.0 lib/schemata/orm/active_record.rb