Sha256: af6d4f776d43298d17a71bc47a6304e1fd623b5daa712ab5f12c3259ac0e6601

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

module Pgcli
  module Rails
    module MonkeyPatch
      def self.apply!
        if ::Rails.gem_version >= Gem::Version.new("7.1.0")
          require "active_record/connection_adapters/postgresql_adapter"
          ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.singleton_class.prepend self
        else
          ::Rails::DBConsole.prepend self
        end
      end

      def find_cmd_and_exec(commands, *args)
        commands = "pgcli" if commands == "psql"
        super(commands, *args)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pgcli-rails-0.9.0 lib/pgcli/rails/monkey_patch.rb
pgcli-rails-0.8.1 lib/pgcli/rails/monkey_patch.rb
pgcli-rails-0.8.0 lib/pgcli/rails/monkey_patch.rb