Sha256: 7e4b7cb079d1c17cf8f2184ba52ecb14f29f3c97d85153dcda04fb2d92bebd02

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

require 'fresh_connection/extend/ar_base'
require 'fresh_connection/extend/ar_relation'
require 'fresh_connection/extend/connection_handler'
require 'fresh_connection/extend/mysql2_adapter'

module FreshConnection
  class Initializer
    class << self
      def extend_active_record
        ActiveRecord::Base.extend FreshConnection::Extend::ArBase

        ActiveRecord::Relation.__send__(:include, FreshConnection::Extend::ArRelation)

        ActiveRecord::ConnectionAdapters::ConnectionHandler.__send__(
          :include, FreshConnection::Extend::ConnectionHandler
        )

        require 'active_record/connection_adapters/mysql2_adapter'
        ActiveRecord::ConnectionAdapters::Mysql2Adapter.__send__(
          :include, FreshConnection::Extend::Mysql2Adapter
        )

        ActiveRecord::Base.establish_fresh_connection
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fresh_connection-0.2.6 lib/fresh_connection/initializer.rb
fresh_connection-0.2.5 lib/fresh_connection/initializer.rb
fresh_connection-0.2.4 lib/fresh_connection/initializer.rb
fresh_connection-0.2.3 lib/fresh_connection/initializer.rb
fresh_connection-0.2.2 lib/fresh_connection/initializer.rb