We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.
The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.
sudo gem install google-appengine sudo gem install appengine-tools --pre
Create a folder for your app
mkdir rails_app; cd rails_app
Download and run the setup script
curl -O http://appengine-jruby.googlecode.com/hg/demos/rails2/rails2_appengine.rb ruby rails2_appengine.rb
Start development server
dev_appserver.rb .
Open local console
appcfg.rb run script/console
Publish to production
appcfg.rb update .
We disable rubygems in the development environment, and the generators from Rails 2 perform various Gem dependency checks that are too difficult to patch, so we run the generators from the MRI.
sudo gem install rails rails_datamapper sudo gem install activerecord-nulldb-adapter
Generate a restful controller and add it to config/routes.rb
./script/generate scaffold article title:string summary:text url:string \ -f --skip-migration
Generate a model for DataMapper
./script/generate dm_model article title:string summary:text url:string \ -f --skip-migration --skip-timestamps
Add timestamps in the new format
class Article include DataMapper::Resource property :id, Serial property :title, String, :nullable => false property :summary, Text, :nullable => false timestamps :at end
When you use the form, you’ll find an error that needs to be patched.
compared with non class/module