Class: ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ SchemaCreation

Returns a new instance of SchemaCreation.


7
8
9
10
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 7

def initialize(conn)
  @conn = conn
  @cache = {}
end

Instance Method Details

#accept(o) ⇒ Object


12
13
14
15
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 12

def accept(o)
  m = @cache[o.class] ||= "visit_#{o.class.name.split('::').last}"
  send m, o
end

#visit_AddColumn(o) ⇒ Object


17
18
19
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 17

def visit_AddColumn(o)
  "ADD #{accept(o)}"
end