Running a rails app with MRI and jRuby
jRuby has become a stable alternative for running rails applications. It gives the ruby programmer access to the vast amount of java libraries that are available. One of our applications uses jRuby for its import tasks, so it can use the power of JDBC to connect to a multitude of data sources, in our case Filemaker Pro.
One of the annoying things about switching between MRI and jRuby is the database configuration. jRuby uses the ‘jdbcmysql’ adapter while MRI uses the ‘mysql’ adapter. Turns out there is a simple fix for this:
adapter: <%= defined?(JRuby) ? 'jdbcmysql' : 'mysql' %>
The database.yml file is evaluated by erb before being parsed by yaml.