format internet:

…please wait (48% completed)…

Posts Tagged ‘rails31’

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

rvm 1.9.2@r31

Are we there already? not yet! Rails 3.1 needs a javascript runtime for all the asset magic. You can choose the runtime of your choice, as long as your choice is one of the options here :p

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

gem 'therubyracer'

And, you know, now you need to bundle it

bundle install --binstubs

And that’s it, now you can do things like

bin/rake -T

Of course you can start the rails server too

bin/rails server

You know the rest of the song.. Now go to http://localhost:3000 and start dancing!

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


Posted in development, javier ramirez, ruby, ruby on rails | Tagged: , , | 3 Comments »