Prologue
Complete this tutorial as a prelude to this blog. This is less about you learning RoR, but more about giving you a convenient starting point to proceed. If you already have a project in mind that you want to migrate, make a copy and work with that. Note for Windows users: When you get to the point of installing the SQLite3 gem, use version 1.2.3 as at the time of this writing, it is the most recent version compatible with Windows;gem install sqlite3-ruby -v 1.2.3 -y
. For your convenience, here are some links you might find useful while completing that tutorial: http://localhost:3000
http://localhost:3000/home/index
Run it on Ruby
So you should now be at a point where you can successfully run your application on Mongrel or WEBrick using MRI. If you haven't done that already, give that a whirl and test it by going here. You should see the 'Hello, Rails!' home page. Now get you hands on the default generatedindex.html
file and put it back in the public folder and hit refresh/F5. You should now see the 'Welcome aboard... You’re riding Ruby on Rails!' welcome page. Click on the 'About your application’s environment' link and you should see a flash message (I think that's what they call it) describing you environment; you should observe two things:
- Ruby Version
- 1.8.6 (i386-mswin32)
- Database adapter
- sqlite3
Prepare for JRuby
- Setup JRuby
- Install Rails (currently 2.3.2)
- jgem install rails -y
- Setup Apache Derby
- Download and install Derby 10.4.2 from here.
- Set your
DERBY_HOME
environment variable and addDERBY_HOME\bin
to yourPATH
environment variable. - Copy
derby.jar
,derbyclient.jar
andderbynet.jar
inDERBY_HOME\lib
toJRUBY_HOME\lib
. jgem install activerecord-jdbcderby-adapter-0.9.0 -y
(I had an issue with version 0.9.1; something about an uninitialized constant...)
- Prepare Development DB
- Update the
RAILS_ROOT\config\database.yml
file; comment out the defaultdevelopment
database definition (or just prepend an underscore or something) and paste in the following below it:development: adapter: jdbc url: jdbc:derby:db\blog_development;create=true driver: org.apache.derby.jdbc.EmbeddedDriver username: app password: app
- Run the following commands:
jrake db:sessions:create jrake db:migrate
- Update the
Run it on JRuby
Now you should be at a point where you can run your application on Mongrel or WEBrick using JRuby. Start it up, this time runningjruby script\server
and test it again by going here. Click on the 'About your application’s environment' link; this time you'll observe two significant differences:
- Ruby Version
- 1.8.6 (java)
- Database adapter
- jdbc
1 comment:
This looks interesting. I am looking forward to the next post in the series...
Post a Comment