Module: StoreSchema::Module::ClassMethods

Defined in:
lib/store_schema/module.rb

Instance Method Summary collapse

Instance Method Details

#store_schema(column, &block) ⇒ Object

Examples:


# Gemfile
gem "store_schema"

# app/models/project.rb
class Website < ActiveRecord::Base

  store_schema :config do |s|
    s.string :name
    s.integer :visitors
    s.float :apdex
    s.boolean :ssl
    s.datetime :published_at
  end
end

Parameters:

  • column (Symbol)

    name of the table column

  • block (Proc)

    the configuration block


29
30
31
32
33
34
# File 'lib/store_schema/module.rb', line 29

def store_schema(column, &block)
  StoreSchema::Configuration.new(column).tap do |config|
    yield(config)
    config.send(:configure, self)
  end
end