-
Notifications
You must be signed in to change notification settings - Fork 14
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
About the db_connection option #9
Comments
@fchampreux I don't know how do you use this gem. Is it ruby on rails application? What rails version? Rails guides mention about
and I think it should work with the connection selected in With a custom connection, you should be able to call for 1:
for 2:
|
@sufleR I'll search in this direction and document it when done.
Thanks !
Le dim. 7 mars 2021 à 00:44, sufleR ***@***.***> a écrit :
… @fchampreux <https://github.com/fchampreux> I don't know how do you use
this gem. Is it ruby on rails application? What rails version?
Rails guides mention about connected_to
https://guides.rubyonrails.org/active_record_multiple_databases.html#using-manual-connection-switching
Inside connected_to block, you should be able to
SqlQuery.new(:get_player_by_email, email: ***@***.***', db_connection: ActiveRecord::Base.connection)
and I think it should work with the connection selected in connected_to.
I'm sorry but I didn't test it.
With a custom connection, you should be able to call establish_connection.
Docs:
https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ConnectionHandler.html#method-i-establish_connection
for 1:
SqlQuery.new(:get_player_by_email, email: ***@***.***', db_connection: ActiveRecord::Base.establish_connection(:development).connection)
for 2:
SqlQuery.new(:get_player_by_email, email: ***@***.***', db_connection: ActiveRecord::Base.establish_connection({database: '', host: , adapter: .....}).connection)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIPJLPFLQEMEFKTPA64HITTCK47HANCNFSM4YSUK7XQ>
.
--
*Frédéric CHAMPREUX+41 78 87 110 55*
|
Not being higly familiar with connections handling, I am wandering how to specify this option when:
I'll be glad to add examples to the documentation when I solve this point :-)
Thanks a lot!
The text was updated successfully, but these errors were encountered: