Tagged: Ruby on Rails

July 24th, 2010

cider, rvm, and homebrew

The rails installed by cider is a rails 3 beta. As I want to play with some of the examples for rails 2 I thought I should get the most recent ruby 1.8.7 and try to use rvm’s gem sets to get myself a rails 2 world set up

brew install `brew outdated`
rvm install ruby-1.8.7-p299
rvm --default ruby-1.8.7-p299

Was my first step to this, but when I tried irb this is what I saw:

ratdog:~ mike$ irb
no such file to load -- map_by_method
ruby-1.8.7-p299 > q

The cause of this was my ~/.irbrc which had been set up, and which has a whole bundle of useful gems added into it. Most of these are worth a post by themselves, but the suspects were:

  • map_by_method
  • what_methods
  • awesome_print
  • net-http-spy
  • hirb
  • looksee
  • wirble
  • sketches

I set up an rvm gemset and started installing gems:

rvm gemset create rails238
rvm ruby-1.8.7-p299@rails238
gem install map_by_method what_methods awesome_print net-http-spy hirb looksee wirble sketches
gem install rails -v 2.3.8
rvm --default ruby-1.8.7-p299@rails238

All appeared to go well, until I tried navigating to a demo appliction and look at the environment on the default splash screen, which complained about a missing sqlite3 gem. The sqlite3 gem wanted at least ruby-1.9.1 installed, so it was time to install another Ruby.

The ruby-1.9.1-p429 had a problem with gems, but a quick trip to Yahoo! revealed this message, so it was time to install another ruby!

rvm install ruby-1.9.1-p378
rvm use ruby-1.9.1-p378 --default
rvm gemset create rails238
rvm use ruby-1.9.1-p378@rails238 --default
gem install map_by_method what_methods awesome_print net-http-spy hirb looksee wirble sketches
gem install rails -v 2.3.8
gem install sqlite3

Now I can get to work playing with rails! The great thing is that I haven’t compromised my system Ruby, thanks to cider, rvm, and homebrew.

October 25th, 2009

The Week in Review

“Don’t believe what you read” seems to be this week’s theme.

On Monday I went to my first Rails Pub Nite for a few months, and there were a good forty or fifty people there. Most of them seemed to be doing some fun and interesting stuff with Rails, and there seemed to be lots of activity. Sometimes when I’m looking around various technology sites or blogs it would seem that the bloom is off the Rails rose, bit the Toronto Rails Pub Nites would offer a different perspective.

On Tuesday it was off to Roy Thomson Hall to hear the Cleveland Orchestra. I was pleasantly surprised that my listening to King Crimson for many years had prepared me to enjoy Shostakovich’s Symphony No. 5. The thing not to believe here is the Toronto Star’s review which seemed to focus on the reviewer’s expectations and not so much on what the Orchestra did.

Nest week it’s the Toronto Perl Mongers, and we’ll see what’s shaking in the local Perl world. There are so many opinions of Perl’s state out there that most of them can’t be true!

March 4th, 2009

Finding the Fun Again

Another few evenings playing with Rails (and paralleling the depot application from Agile Web Development with Rails (v3)) and I’m rediscovering the fun to be had with programming!

I have picked a project which is similar to something I’m doing at work to see what new perspectives using a different language and toolkit give me.

The biggest thing I noticed was that PostgreSQL and pgadmin3 is a delight to use.

February 25th, 2009

Rails Progress (slow but sure)

Each day when I have an hour or so to spare I am picking another aspect of my “toy” Rails application to work on. My strategy is to set small achievable goals, in the understanding that I will need to do some research and make some mistakes.

Many problems I come across seem to be due to poor scaling – a developer with a database with a few tens of rows sometimes never gets a taste of a the system with millions of rows under heavy load until users are out for blood.

Thanks to Jason Frankovitz I started looking at Railscasts, and this turned me on to the will_paginate plugin for pagination.

So now I have a migration which cooks up 10,000 user rows, and then I notice the difference in the naive “list all the users” and the paginated “list all the users, a page at a time”

One feature done today… now for the household chores: cat litter changing and putting out the garbage and recycling.

February 21st, 2009

Keeping going with Rails

My experiments with Rails are moving along slowly, and I’m happy with that. One of the things I have learned that I sometimes sabotage myself by expecting to do too much too quickly and then becoming despondent when things don’t move as quickly as I had expected. If I step back then I see how many things I’m doing:

  • Learning about VirtualBox.
  • Learning how to use Git.
  • Trying to learn Rails 2.2 using Rails 1.2 tutorials (D’oh!)
  • Setting up vim to be a productive “IDE” for Rails.
  • Taking another look at what PostgreSQL has to offer.

With Git and Rails I’m not just trying to use the tools well, I’m also internalising their way of looking at the world. That comes in its own good time. As for using vim (or vi) effectively, I have limped along with my limited repertoire for more than 20 years, so I should not have unrealistic expectations there!