Skip to content

Commit

Permalink
Fix support for dbconsole on Rails edge
Browse files Browse the repository at this point in the history
Ref:
- Move dbconsole logic to Active Record connection adapter: rails/rails@4bcb8e4 rails/rails#46093
- Use adapter_class instead of connection_class for adapters: rails/rails@5bb357f rails/rails#46166
  • Loading branch information
tagliala committed Oct 8, 2022
1 parent 758232b commit 46516d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/active_record/connection_adapters/chronomodel_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module ActiveRecord
module ConnectionHandling
def chronomodel_adapter_class
ConnectionAdapters::PostgreSQLAdapter
end

# Install the new adapter in ActiveRecord. This approach is required because
# the PG adapter defines +add_column+ itself, thus making impossible to use
Expand Down
2 changes: 1 addition & 1 deletion lib/chrono_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def chrono?
prepend ChronoModel::Patches::Batches::BatchEnumerator
end

if defined?(Rails::DBConsole)
if defined?(Rails::DBConsole) && Rails.version < '7.1'
Rails::DBConsole.instance_eval do
if Rails.version < '6.1'
prepend ChronoModel::Patches::DBConsole::Config
Expand Down

0 comments on commit 46516d1

Please sign in to comment.