Skip to content

Fix deprecation warning when showing error with rails 6.#1

Open
madleech wants to merge 1 commit into
ioquatix:masterfrom
madleech:fix-rails-6-error
Open

Fix deprecation warning when showing error with rails 6.#1
madleech wants to merge 1 commit into
ioquatix:masterfrom
madleech:fix-rails-6-error

Conversation

@madleech

Copy link
Copy Markdown
Collaborator

This fixes the following error when using Rails 6:

ActiveRecord::Base.configurations in Rails 6 now returns an object instead of a hash. The keys method is not supported. Please use configs_for or consult the documentation for supported methods.

Context:

/Users/michael/.rvm/gems/ruby-2.5.1/gems/activerecord-6.0.3.3/lib/active_record/database_configurations.rb:221:in `method_missing': `ActiveRecord::Base.configurations` in Rails 6 now returns an object instead of a hash. The `keys` method is not supported. Please use `configs_for` or consult the documentation for supported methods. (NotImplementedError)
  1: from /Users/michael/.rvm/gems/ruby-2.5.1/gems/activerecord-migrations-1.5.0/lib/active_record/migrations/tasks.rb:45:in `each_current_configuration'
  2: from /Users/michael/.rvm/gems/ruby-2.5.1/gems/activerecord-6.0.3.3/lib/active_record/tasks/database_tasks.rb:207:in `drop_current'

... which happens when RAILS_ENV and DATABASE_VARIANT disagree with each other.

Added a unit test to show a possible invocation.

@ddoherty03

Copy link
Copy Markdown

Any chance of getting this merged into master? I'm getting this after upping to AR6 for a non-rails app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants