TOTD #81: How to configure "database.yml" to be used with both JRuby and MRI ?
By arungupta on May 04, 2009
In JRuby-on-Rails tutorial at Rails Conf 2009, Nick Sieger shared a nice little tip on how to configure "database.yml" to be usable with both JRuby and MRI:
|<% jdbc = defined?(JRUBY_VERSION) ? 'jdbc' : ''
adapter: <%= jdbc %>mysql
"JRUBY_VERSION" is defined only if your using JRuby and so the right database adapter is picked up accordingly.
The complete slides for the tutorial are available here. Learn about other related talks here.
Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. An archive of all the tips is available here.
Technorati: conf railsconf lasvegas tutorial jruby ruby rubyonrails