ActiveRecord JDBC 0.5
Posted by Nick Sieger Sun, 02 Sep 2007 04:47:26 GMT
This one’s a bit late -- consider it part of my get-caught-up-since-unclogging-the-clogged-blog series.
ActiveRecord JDBC 0.5 is out, so you may have heard (it went out the door a week ago Friday; c.f.
Arun and Tom). The major feature you get in this version is a new database.yml
configuration style:
development:
adapter: mysql
database: blog_development
username: root
password:
Ok, ok, so what’s the big deal? This is just Rails’ default database configuration. Well, that’s the
point -- you no longer have to know anything about JDBC URLs, driver class names, and all that. We’ve baked it in for you. This should make it easier than ever to try out your Rails application on JRuby, as the only piece of manual configuration left for you is the ugly bit of JRuby-specific code you need to activate ActiveRecord-JDBC lurking right above the Rails::Initializer
:
if RUBY_PLATFORM =~ /java/
require 'rubygems'
gem 'ActiveRecord-JDBC'
require 'jdbc_adapter'
end
If we can obliterate the need for this last bit of code, and make it easy to obtain the necessary driver bits, I’ll feel good enough to call this thing a 1.0 product.
Don’t forget you need to require the jar files for each database you need to use.