JRuby语言内部报道:全面简化数据库适配器ActiveRecord-JDBC 0.6
- ActiveRecord-JDBC新的软件包名称
JDBC数据库适配器
或者jruby -S gem install activerecord-jdbc-adapter
MySQL数据库适配器jruby -S gem install activerecord-jdbcmysql-adapter --include-dependencies
- 数据库文件config/database.yml
旧配置方法
新配置方法production:
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/database_production
username: root
password: rootproduction:
adapter: jdbcmysql
database: database_production
username: root
password: root
host: localhost - 环境文件config/environment.rb
Rails框架<2.0
Rails框架>=2.0if RUBY_PLATFORM =~ /java/
require 'rubygems'
gem 'activerecord-jdbc-adapter'
require 'jdbc_adapter'
end
【不再需要】 - 参考资料
http://jruby-extras.rubyforge.org/svn/trunk/activerecord-jdbc/README.txt
ActiveRecord-JDBC 0.6 Released: Much Easier to Run Rails in JRuby - 网站链接
http://rubyforge.org/projects/jruby-extras