Sha256: 5bc36750f03dc0a9e072f25d1497ef696547e51cf6a8114deba95095ce45d31c

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

module TableRenamable
  class Engine < ::Rails::Engine
    isolate_namespace TableRenamable

    config.after_initialize do
      # set up our reload behavior for when table names change for MySQL
      if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
        ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(
          :include,
          TableRenamable::ConnectionAdapters::Mysql2Adapter
        )
      # same thing for SQLite
      elsif defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter)
        ActiveRecord::ConnectionAdapters::SQLite3Adapter.send(
          :include,
          TableRenamable::ConnectionAdapters::SQLite3Adapter
        )
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
table_renamable-3.0.0 lib/table_renamable/engine.rb
table_renamable-0.0.1 lib/table_renamable/engine.rb