Defining connection session variables via database.yml

I came across a use case where I needed provide session variables for
a connection.
For example some of these [1]. I see it was reported here [2] 5 years ago.

Would something like passing:

session_variables: time_zone=UTC,someVar=someValue

in the database.yml config be acceptable as a solution?

Thanks,

[1] http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
[2] https://rails.lighthouseapp.com/projects/8994/tickets/3579-activerecord-not-settingchecking-mysql-session-variable-time_zone

Vipul A.M.

This is already implemented as of 4.1

http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/MysqlAdapter.html

Cheers
Thong

Hi,

It seems to already be implemented. Matthew pointed there is


and
I see https://github.com/rails/rails/commit/97d06e8c4bd44154abda41a3f7e4bc49929a919f
was implemented 2 years ago.
Although its not documented.

Sorry for the noise and thanks Matthew!
Vipul A.M.
+91-8149-204995