Nick Sieger: JRuby and Rails 3, Sitting in a Tree http://blog.nicksieger.com/articles/2010/02/24/jruby-and-rails-3-sitting-in-a-tree en-us 40 JRuby and Rails 3, Sitting in a Tree <h2>Synopsis</h2> <pre><code>jruby -S rails new myapp -m http://jruby.org/rails3.rb </code></pre> <p>When creating your Rails 3 application, just add the JRuby&#45;specific template (<code>-m http://jruby.org/rails3.rb</code>)&#46;</p> <h2>Details</h2> <pre><code>$ jruby -S gem install rails --pre --no-rdoc --no-ri Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work Successfully installed i18n-0.3.3 Successfully installed tzinfo-0.3.16 Successfully installed builder-2.1.2 Successfully installed memcache-client-1.7.8 Successfully installed activesupport-3.0.0.beta Successfully installed activemodel-3.0.0.beta Successfully installed rack-1.1.0 Successfully installed rack-test-0.5.3 Successfully installed rack-mount-0.4.7 Successfully installed abstract-1.0.0 Successfully installed erubis-2.6.5 Successfully installed actionpack-3.0.0.beta Successfully installed arel-0.2.1 Successfully installed activerecord-3.0.0.beta Successfully installed activeresource-3.0.0.beta Successfully installed mime-types-1.16 Successfully installed mail-2.1.3 Successfully installed text-hyphen-1.0.0 Successfully installed text-format-1.0.0 Successfully installed actionmailer-3.0.0.beta Successfully installed thor-0.13.3 Successfully installed railties-3.0.0.beta Successfully installed bundler-0.9.7 Successfully installed rails-3.0.0.beta 24 gems installed </code></pre> <h3>And:</h3> <pre><code>$ jruby -S gem install activerecord-jdbcsqlite3-adapter --no-rdoc --no-ri Successfully installed activerecord-jdbc-adapter-0.9.3-java Successfully installed jdbc-sqlite3-3.6.3.054 Successfully installed activerecord-jdbcsqlite3-adapter-0.9.3-java 3 gems installed </code></pre> <h3>Finally:</h3> <pre><code>$ jruby -S rails new myapp -m http://jruby.org/rails3.rb create ...(app creation)... apply http://jruby.org/rails3.rb apply http://jruby.org/templates/default.rb gsub Gemfile run jruby script/rails generate jdbc from "." ...(warnings omitted)... exist create config/initializers/jdbc.rb create lib/tasks/jdbc.rake $ cd myapp $ jruby script/rails server ...(warnings omitted)... =&gt; Booting WEBrick =&gt; Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000 =&gt; Call with -d to detach =&gt; Ctrl-C to shutdown server [2010-02-23 19:44:26] INFO WEBrick 1.3.1 [2010-02-23 19:44:26] INFO ruby 1.8.7 (2010-02-23) [java] [2010-02-23 19:44:26] INFO WEBrick::HTTPServer#start: pid=16449 port=3000 </code></pre> <p><img src="http://img.skitch.com/20100224-eik9e957x7uu8k5x8y4xgt9jes.jpg" alt="rails-welcome"/></p> <h2>Recap</h2> <p>You&#8217;ll have best results with <a href="http://ci.jruby.org/snapshots">JRuby 1&#46;5 snapshots</a>, which include RubyGems 1&#46;3&#46;6&#46; JRuby 1&#46;5 final is coming soon&#46; Also, <a href="http://rubyforge.org/forum/forum.php?forum_id=36489">the new <code>activerecord-jdbc-adapter</code> 0&#46;9&#46;3 release</a> is required for Rails 3 compatibility&#46;</p> <p>The Rails experience on JRuby continues to get better&#46;</p> Wed, 24 Feb 2010 03:58:00 +0000 urn:uuid:603837d6-55bf-4e03-8fec-4d2db26c002e Nick Sieger http://blog.nicksieger.com/articles/2010/02/24/jruby-and-rails-3-sitting-in-a-tree jruby rails http://blog.nicksieger.com/articles/trackback/544