Clean up module usage. There's no need to use InstanceMethods -- normal Ruby modules and includes will work fine here.
This commit is contained in:
parent
a41050c2b5
commit
b5261d0225
|
@ -2,5 +2,5 @@ require "active_record/connection_adapters/mysql2_adapter"
|
||||||
require "activerecord-import/adapters/mysql_adapter"
|
require "activerecord-import/adapters/mysql_adapter"
|
||||||
|
|
||||||
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
||||||
include ActiveRecord::Import::MysqlAdapter::InstanceMethods
|
include ActiveRecord::Import::MysqlAdapter
|
||||||
end
|
end
|
|
@ -2,5 +2,5 @@ require "active_record/connection_adapters/mysql_adapter"
|
||||||
require "activerecord-import/adapters/mysql_adapter"
|
require "activerecord-import/adapters/mysql_adapter"
|
||||||
|
|
||||||
class ActiveRecord::ConnectionAdapters::MysqlAdapter
|
class ActiveRecord::ConnectionAdapters::MysqlAdapter
|
||||||
include ActiveRecord::Import::MysqlAdapter::InstanceMethods
|
include ActiveRecord::Import::MysqlAdapter
|
||||||
end
|
end
|
|
@ -2,6 +2,6 @@ require "active_record/connection_adapters/postgresql_adapter"
|
||||||
require "activerecord-import/adapters/postgresql_adapter"
|
require "activerecord-import/adapters/postgresql_adapter"
|
||||||
|
|
||||||
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
||||||
include ActiveRecord::Import::PostgreSQLAdapter::InstanceMethods
|
include ActiveRecord::Import::PostgreSQLAdapter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@ require "active_record/connection_adapters/sqlite3_adapter"
|
||||||
require "activerecord-import/adapters/sqlite3_adapter"
|
require "activerecord-import/adapters/sqlite3_adapter"
|
||||||
|
|
||||||
class ActiveRecord::ConnectionAdapters::Sqlite3Adapter
|
class ActiveRecord::ConnectionAdapters::Sqlite3Adapter
|
||||||
include ActiveRecord::Import::Sqlite3Adapter::InstanceMethods
|
include ActiveRecord::Import::Sqlite3Adapter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
module ActiveRecord::Import::MysqlAdapter
|
module ActiveRecord::Import::MysqlAdapter
|
||||||
module InstanceMethods
|
|
||||||
def self.included(klass)
|
|
||||||
klass.instance_eval do
|
|
||||||
include ActiveRecord::Import::ImportSupport
|
include ActiveRecord::Import::ImportSupport
|
||||||
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
|
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the maximum number of bytes that the server will allow
|
# Returns the maximum number of bytes that the server will allow
|
||||||
# in a single packet
|
# in a single packet
|
||||||
|
@ -55,5 +50,4 @@ module ActiveRecord::Import::MysqlAdapter
|
||||||
def duplicate_key_update_error?(exception)# :nodoc:
|
def duplicate_key_update_error?(exception)# :nodoc:
|
||||||
exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')
|
exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
|
@ -1,13 +1,7 @@
|
||||||
module ActiveRecord::Import::PostgreSQLAdapter
|
module ActiveRecord::Import::PostgreSQLAdapter
|
||||||
module InstanceMethods
|
|
||||||
def self.included(klass)
|
|
||||||
klass.instance_eval do
|
|
||||||
include ActiveRecord::Import::ImportSupport
|
include ActiveRecord::Import::ImportSupport
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def next_value_for_sequence(sequence_name)
|
def next_value_for_sequence(sequence_name)
|
||||||
%{nextval('#{sequence_name}')}
|
%{nextval('#{sequence_name}')}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
module ActiveRecord::Import::Sqlite3Adapter
|
module ActiveRecord::Import::Sqlite3Adapter
|
||||||
module InstanceMethods
|
|
||||||
def next_value_for_sequence(sequence_name)
|
def next_value_for_sequence(sequence_name)
|
||||||
%{nextval('#{sequence_name}')}
|
%{nextval('#{sequence_name}')}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue