Trying out Rails 3.1
Posted by javier ramirez on June 30, 2011
Rails 3.1 is almost here, and all the rock star ninja hipster early adopters have been playing with it for a while. I’m not a ninja (picture me with a black tight skin suit if you wonder why), so I didn’t install it until today.
Installation is pretty straight forward, but there are a couple of tricks, so here they are in full Technicolor to save you a couple of minutes.
The first thing you are going to need is the right gem, which you can install directly via
gem install rails --pre
I didn’t want to install it as a system-wide gem, so I created a new gemset in rvm like this
rvm gemset create r31
If you are on windows and don’t have rvm, maybe you could install another version of ruby via pik, but I cannot help you with that.
Anyway, system-wide or scoped to a local gemset, after installing the gem you should be able to create your first rails 3.1 project like this
rails new sandbox
If you are on rvm, don’t forget to create a .rvmrc file with your local gemset to make things more convenient. In my case the contents of the file are
I chose (see update below!) the rubyracer because I’ve heard good things about it lately, but what do I know, just pick the one you prefer and add it to your gemfile. In my case it looks like this
And, you know, now you need to bundle it
bundle install --binstubs
And that’s it, now you can do things like
Of course you can start the rails server too
You know the rest of the song.. Now go to http://localhost:3000 and start dancing!
update: i found some errors when using ruby 1.9.2p0, therubyracer and coffescript. I changed to nodejs (just install it and leave the binary somewhere in your path) and things got back to normal