Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multi-database configuration via AR base model selection #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

schmijos
Copy link

@schmijos schmijos commented Jan 25, 2024

This is a proper follow-up to #129. We add two configuration options:

  • abstract_model_class
    All explorative calls in this gem will be redirected to this class. Default is ActiveRecord::Base.
  • available_abstract_model_classes
    If there is more than one entry, the GUI will allow you to select abstract_model_class. Default is [ActiveRecord::Base]

Remarks:

  • I decided against reorganizing RailsDb::Connection and RailsDb::Database to keep compatibility for older Rails versions. This is also the reason why there must be two config options. The better way forward would probably be to look at the database configuration (ActiveRecord::DatabaseConfigurations) instead.
  • This PR doesn't fix the fallback in lib/rails_db/connection.rb:7. It is still broken for Rails >= 6.1.
  • bin/runsql and lib/standalone.rb will still use ActiveRecord::Base.

Impression:
CleanShot 2024-01-25 at 12 06 05@2x

@schmijos schmijos mentioned this pull request Feb 16, 2024
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.

1 participant