How to setup a Rails 3 app
I finally decided to give Rails 3 a spin after beta was released 20 days ago. In geek time, that’s being a late adopter. But first, a warning. I’ve read several posts about setting up Rails 3 and as of today, some of them are outdated already. Things are happening so fast that it is not impossible my setup becomes out of date too in just a matter of days.
Preconditions:
- ruby 1.8.7
- rubygem 1.3.6
- a clean gem repository
Yes, I removed all the gems in my laptop because I want to see clearly what’s happening in my setup. Also, I have tons of obsolete and unused gems that I figure it’s easier to remove them all.
quickie version
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n --no-rdoc --no-ri sudo gem install rails --pre --no-rdoc --no-ri rails mojo cd mojo sudo gem install sqlite3-ruby --no-rdoc --no-ri rails server
Rails 3 requires ruby 1.8.7
I was using 1.8.6 and I guess there’s no harm in trying. After being coerced to upgrade ruby, I also upgraded rubygems to 1.3.6. This also means many gems need to be upgraded and/or rebuilt. Heck, I’ll just delete them :)
Unknown command bundle
If you got this error, you followed wycats’ post on setting up Rails 3. The correct command is ‘bundle install’
undefined method `directory’
If you got this error, you read wycats’ post but you didn’t read the 37th comment. wycats’ post is outdated.
‘bundle install’ fail
If bundle install becomes unresponsive, as was the case in all of my attempts, just skip it and install the gems yourself. Ideally, all these gem install steps would be handled by bundle install but as I’ve said, it’s failing on me and I don’t know why.
These are the gems installed after this experiment:
*** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0.beta) actionpack (3.0.0.beta) activemodel (3.0.0.beta) activerecord (3.0.0.beta) activeresource (3.0.0.beta) activesupport (3.0.0.beta, 2.3.5) arel (0.2.1) builder (2.1.2) bundler (0.9.7) erubis (2.6.5) i18n (0.3.3) mail (2.1.3) memcache-client (1.7.8) mime-types (1.16) rack (1.1.0) rack-mount (0.6.0, 0.4.7) rack-test (0.5.3) rails (3.0.0.beta) railties (3.0.0.beta) rake (0.8.7) sqlite3-ruby (1.2.5) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.3) tzinfo (0.3.16)
Related posts:
- Deploy a Rails 3, Sqlite3 application in Tomcat using JRuby and have a Ruby version running side-by-side. A few months ago I got interested in JRuby while researching for text mining algorithms. I found some gems but they are either...
- Rails 3 upgrade part 1: Booting the application It’s time for another Rails upgrade! We all have our share of bad experiences and frustrations every time we upgrade a piece of software. Even for technical people who live...
- Rails 3 upgrade part 4: Prototype helpers and Javascript Rails 3 is embracing the unobtrusive Javascript (or UJS) mantra which is good because it is the right way; at the same time, it is bad because many applications will...
- Rails 3 upgrade part 2: Routes In the previous post, I outlined the steps I took to upgrade and boot a Rails 3 application. This time, I share my experience upgrading the routes file. By the...
- How to share code between Javascript and Rails Rails’ validations is great because it allows you to quickly implement the valid states of your models and at the same time have a ready-made way of displaying the errors...
When running an app for 2.3, I get this segmentation error:
rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb:7: [BUG] Segmentation fault
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0]
The error disappears with an old release (p174).
Greg Moreno
24 Feb 10 at 4:28 pm
Yes Greg I get the same problem. If you’re using the Bitnami Ruby stack I’ve had no luck as it includes 248. Pretty serious regression it seems, shame, kinda defeats the purpose of a bundle :(
Julian
6 Mar 10 at 8:44 am
I hear you Julian. It took me a while to realize I was looking at the wrong problem. I trusted the ruby release and I thought it’s a Rails 3 problem being a beta.
Greg Moreno
6 Mar 10 at 11:56 am