Cast connection options to correct datatype. #313

merged 1 commit into from Oct 4, 2012


None yet

3 participants

drn commented Oct 4, 2012

In order to set database connection options on Heroku using the Amazon RDS add-on, we need to specify the connection options via the DATABASE_URL as such:


However, these connection options are interpreted as strings when initializing the mysql2 client which results in failures like:

2012-10-04T23:13:05+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.12b4/lib/mysql2/client.rb:26:in `connect_timeout=': wrong argument type String (expected Fixnum) (TypeError)
2012-10-04T23:13:05+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.12b4/lib/mysql2/client.rb:26:in `block in initialize'
2012-10-04T23:13:05+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.12b4/lib/mysql2/client.rb:24:in `each'
2012-10-04T23:13:05+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.12b4/lib/mysql2/client.rb:24:in `initialize'

This pull casts the connection option values to the desired types.

@brianmario brianmario merged commit 3385de3 into brianmario:master Oct 4, 2012

1 check failed

Details default The Travis build failed

thanks! don't worry about that travis failure - it's something unrelated while trying to build on ruby-head.

drn commented Oct 4, 2012

cool :)

sodabrew commented Oct 5, 2012

Nice patch. I'm giving myself a facepalm.

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