class method self.define

Ruby on Rails 4.0.13

Since v2.2.3 Last seen in v6.1.7.10

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10

Signature

self.define(info={}, &block)

Eval the given block. All methods available to the current connection adapter are available within the block, so you can easily use the database definition DSL to build up your schema (create_table, add_index, etc.).

The info hash is optional, and if given is used to define metadata about the current schema (currently, only the schema’s version):

ActiveRecord::Schema.define(version: 20380119000001) do
  ...
end

Parameters

info opt = {}
block block
Source
# File activerecord/lib/active_record/schema.rb, line 61
    def self.define(info={}, &block)
      new.define(info, &block)
    end

Defined in activerecord/lib/active_record/schema.rb line 61 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Schema

Type at least 2 characters to search.

↑↓ navigate · open · esc close