Sunday, March 22, 2009

What I did when upgrading from Ruby on Rails 2.2.2 to 2.3.2

I write what I had to do to upgrade Ruby on Rails from 2.2.2 to 2.3.2.
Development machine is Mac OS X Leopard and production server is Ubuntu Hardy.

1. (development machine) Update Ruby on Rails.

$ sudo gem update rails

2. (development machine) Update all the gems.
(Note: 1. above can be done in one shot in here. But I'm just writing following the order I did as much as possible.)

$ sudo gem update

3. (development machine) Under RAILS_ROOT for the Ruby on Rails application, execute rake to update Rails.

$ rake rails:update

This updates the following files:


4. (development machine) In the Ruby on Rails application, rename application.rb to application_controller.rb.

5. (development machine) In the Ruby on Rails application, in environment.rb, change the version to 2.3.2.

6. (development machine) Installe system_timer gem.

$ sudo gem install system_timer

This is because of a warning when script/server:

[memcache-client] Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: no such file to load -- system_timer

7. (development machine) In ApplicationController, comment out:

session :session_key => '_session_id'

because of the warning in script/server:

DEPRECATION WARNING: Disabling sessions for a single controller has been deprecated. Sessions are now lazy loaded. So if you don't access them, consider them off. You can still modify the session cookie options with request.session_options.

8. (development machine) In environment.rb, change as following based on what's written in release note (


config.action_controller.session = { :session_key => '_some_session',


config.action_controller.session = { :key => '_some_session',

I use RedCloth and followed what is written here ( to make it work.
But after the fact, only the steps 1 to 5 above should allow the application to start with script/server.

The following are the steps to make RSpec work.

9. (development machine) In routes specs, change :id => 1 to :id => '1'.
Also for nested routes, do the same thing e.g. :register_id => 1 to :register_id => "1"

10. (development machine) For the controller method that takes care of javascript, which doesn't have a corresponding .html.erb file, add:

:format => 'js'

for get in spec. e.g.

get :index, :format => 'js', :topic_id => "1",
:selected_sub_topic_id => "2"

This is because even though controller spec is separate from view, RSpec couldn't catch up with the change in Ruby on Rails, and the existence of the corresponding .html.erb is required.

11. (development machine) RSpec correctly detects OrderedHash instead of array of array. Ruby on Rails returns OrderedHash for group_by. So change such as following:

[ [ mock_jurisdiction, [ mock_bulletin ] ] ]


{ mock_jurisdiction => [ mock_bulletin ] }

Note: As far as I observed, Ruby on Rails itself was already using OrderedHash in 2.2.2 but RSpec was failing if I use the Hash format. Now it fails with array format.

The following is a step to make CruiseControl.rb (fork with GIT support) work.

12. (continuous integration server) Delete all the unpacked gems in .cruise/projects/RAILS_ROOT/work/vendor/gems because CruiseControl complains such as

config.gem: Unpacked gem RedCloth-4.0.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.

even after unpacked gem is removed from the Ruby on Rails application itself.

The following is a step to make Capistrano work.

13. (production server) Update all the gems. (Actually this had already been done as a part of Ruby on Rails upgrade in production server.)

$ sudo gem update

14. (development machine) Under RAILS_ROOT for the Ruby on Rails application,

$ script/plugin install

because commands/process/spawner that is used Mongrel is deprecated. (

Saturday, March 14, 2009

Language can be understood even when it's not totally correct

I have attended a Japanese Language Speech Contest because I wanted to know how I feel from the opposite side after struggling to communicate well naturally in English and putting an effort to learn French.
I have found that the language can be understood even when it was not spoken 100% correctly.
I even thought that that's how language evolves.
So it's OK and I don't have to worry about speaking a foreign language even when I accidentally make a mistake.
Native speaker of the language can understand what I'm trying to say.

With that confidence, I write this blog in French as well, even though I will make mistakes.

J'ai assisté au concours d'élocution japonaise parce que j'ai voulu savoir comment j'aurai senti en écoutant de la parole en ma langue maternelle par les gens avec les langues maternelles que j'avais essayé d'apprendre et avec lesquelles j'avais essayé de survivre.
J'ai trouvé que c'est facile de comprendre une parole malgré elle n'est pas tellement correct.
J'ai imaginé que ce soit comment le langage change.
Alors, c'est pas grave si je parle l'autre langue et fais erreur.


Poco a poco. Yo hablo otro idioma. Poquito de Español (Castellano).

Monday, March 09, 2009

Continuous Deployment

One of the Kent Beck's talks I watched quite a while ago said that there was a trend of more frequent deployment.

Also a developer I talked to about two months ago mentioned that his team was going into that approach.

And there was an InfoQ article about it today:
"Beyond Continuous Integration: Continuous Deployment"