diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb | 12 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 9 |
2 files changed, 18 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index b5ddef32af..eab61085e3 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -114,9 +114,15 @@ module ActiveRecord # Set the connection for the class. def self.connection=(spec) - raise ConnectionNotEstablished unless spec - conn = self.send(spec.adapter_method, spec.config) - active_connections[self] = conn + if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter) + active_connections[self] = spec + elsif spec.kind_of?(ConnectionSpecification) + self.connection = self.send(spec.adapter_method, spec.config) + elsif spec.nil? + raise ConnectionNotEstablished + else + establish_connection spec + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 90dc951b6d..c45454eacc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -90,6 +90,15 @@ module ActiveRecord end end end + + def default_sequence_name(table, column) + nil + end + + # Set the sequence to the max value of the table's column. + def reset_sequence!(table, column, sequence = nil) + # Do nothing by default. Implement for PostgreSQL, Oracle, ... + end end end end |