Class: ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
Direct Known Subclasses
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::SchemaCreation, PostgreSQLAdapter::SchemaCreation
Instance Method Summary collapse
- #accept(o) ⇒ Object
-
#initialize(conn) ⇒ SchemaCreation
constructor
A new instance of SchemaCreation.
- #visit_AddColumn(o) ⇒ Object
Constructor Details
#initialize(conn) ⇒ SchemaCreation
Returns a new instance of SchemaCreation.
107 108 109 110 |
# File 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb', line 107 def initialize(conn) @conn = conn @cache = {} end |
Instance Method Details
#accept(o) ⇒ Object
112 113 114 115 |
# File 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb', line 112 def accept(o) m = @cache[o.class] ||= "visit_#{o.class.name.split('::').last}" send m, o end |
#visit_AddColumn(o) ⇒ Object
117 118 119 120 121 |
# File 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb', line 117 def visit_AddColumn(o) sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale) sql = "ADD #{quote_column_name(o.name)} #{sql_type}" (sql, (o)) end |