Rails 2.0 on Leopard
February 15, 2008 § 3 Comments
I wanted to try out some of the new Ruby on Rails 2.0 features in Leopard, so I may as well blog my notes here for future reference.
1. Update Gems
Use this if you haven’t ugpraded your system to Rails 2.0 yet.
sudo gem update --system # Update "gems" itself sudo gem install rails # not just update, since there's new components sudo gem uninstall actionwebservice # Get rid of SOAP; REST rules! sudo gem update # update everything else, to help Rails 2.0 compatibility yes | sudo gem cleanup # Remove old versions yes | sudo gem cleanup # Twice, because of dependencies gem list actionmailer (2.0.2) actionpack (2.0.2) activerecord (2.0.2) activeresource (2.0.2) activesupport (2.0.2)... mongrel (1.1.3)... rails (2.0.2) rake (0.8.1)... sqlite3-ruby (1.2.1) ...
2. Create Project
Create the Rails project, and make sure it and Mongrel work properly.
cd ~/Developer # where I keep all my Rails projects rails miniblog # Create new Rails hierarchy cd !$ open http://0.0.0.0:3000 && script/server # start server and launch Safari => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000
3. Create Scaffold
Use [Command-T] to create a new Tab in Terminal, so the server can keep displaying output in original Tab.
cd ~/Developer/miniblog script/generate scaffold article title:string content:text open http://0.0.0.0:3000/articles # Will return error, since no tables
4. Add to Xcode Organizer
- Launch Xcode
- Click on Window -> Organizer (Ctrl-Command-O)
- Drag ~/Developer/miniblog into Organizer window
- Select “miniblog”
- Under ‘Action’, choose “rake db:migrate”
ActiveResource: The RESTful standard
September 27, 2007 § 1 Comment