random code and what not

ruby 1.9.2 and rails 3rc with rvm

Get up and running with rails 3 release candidate on ruby 1.9.2

First step install rvm (ruby version manager) - note that rvm does not work on windows, for windows try pik

You will need to wait between each step as installation times will vary

# install 1.9.2 using rvm
 rvm install 1.9.2  
# this installed the official release 1.9.2-p0

# switch to 1.9.2
 rvm 1.9.2 
# gem install rails rc
 gem install rails –pre 

# create a new rails app, in this case ‘sample-r3’, this differs from older versions of rails; new is a required arg 
 rails new sample-r3 
# navigate to the root of your new rails app
 cd sample-r3 
# install the app dependencies - in this case sqlite3, see Gemfile in the root dir
 bundle install 

# generate a user scaffold, note g is shortcut for generate
 rails g scaffold User name:string email:string 
# create the database table users
 rake db:migrate 
# start up the rails server, note s is shortcut for server
 rails s 

Browse to http://localhost:3000/users and we are up and running and yes the scaffold pages still have the same old look and feel

In the past I have tried installing and running rails3 beta and rc on different versions of ruby and ran into some serious difficulties; but it has been painless on the official release of ruby 1.9.2

As a final step we want to add a .rvmrc file to the root of the rails project, this will force rvm to load the correct ruby version when we are in this directory. This can be quite handy, if we were on a different version of ruby running ‘rails s’ would create a new rails app directory named ‘s’ instead of running the server; from the terminal run

 echo “rvm 1.9.2” > .rvmrc 

I learned about the .rvmrc file from this post