-
Notifications
You must be signed in to change notification settings - Fork 188
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
Rails 6.1.0.rc1 unable to establish connection to the database that holds our sessions #167
Comments
Would you accept a PR that adds a SessionBase abstract class that inherits from ActiveRecord::Base, and then switch to inheriting from it, so we can have some control over which database it will use by doing something like this?
Then in our code, we could do this?
|
This allows other programmers to specify the correct database connection criteria See rails#167
It was easy enough to try, and seems to fix my problem, so I went ahead with the PR. I says seems because I have a lot of errors in my upgrade to get through, but I hope that will solve this one. |
The solution we ended up with was having our
|
As I mentioned in #169, I think the fact that you have to go around and make another abstract class to achieve this functionality doesn't sound right to me, so let's find an alternative solution. Let me check with people who familiar with the multi-database stuff to see what they would recommend. Generally, I think if you, say, set the |
Ok, I've discussed with people who's familiar with the issue, and I think I have a conclusion on how we should support this. Note that based on @eileencodes's comment in rails/rails#40219 (comment), I don't think it's wise to suggest user to use However, if user understands the caveat, then I think will happily accepting a PR that makes |
I just noticed #168 ... sorry for the confusion 🤦 Still, I'm tempted that we should add support for that in our gem instead of asking user to create a new abstract class in their app as I said above, so maybe I'll reopen #168 and merge it. @eileencodes can I have your second opinion on this? |
If you have multiple databases creating a new abstract class isn't going to be that many more steps than if we made an abstract class. App users would still need to add So I don't want to merge #168, it only needs to be abstract for multi-db and in those cases since you need to explicitly connect to the right database, making the abstract class in your app is the right way to fix the problem described here. |
Is there any update about this? |
@h0jeZvgoxFepBQ2C we went with this solution: |
In Rails 6.0, we were able to connect the ActiveRecord Session Store to the database that holds our sessions, like this:
However, in Rails 6.1.0.rc1, this gives an error:
As we cannot change the base class of
ActiveRecord::SessionStore::Session
, will there be (or is there) some other way to tell Rails that the session should always be fetched from a specific database?The text was updated successfully, but these errors were encountered: