Ruby On Rails, Design, Simplicity, Web 2.0, Ajax, Mac and Tons of Pizza.

May 29

Upgrading your Rails app from Rails 2.1 to Rails 2.3....

Posted by Annalisa Afeltra in Ruby on Rails - 1 comment digg this add to delicious

If you still have some of your rails applications in Rails 2.1, here is how to start migrating to Rails 2.3 and take advantage of the new features….

Firstly, create a branch of your application

svn checkout path_of_application

Delete your current rails folder from vendor/rails from your branched application (if you had frozen rails into your app before) Install the Rails 2.3.2 framework and then freeze it into your application with these two commands:

sudo gem install rails --version 2.3.2
rake rails:freeze:gems

create a sample rails 2.3 application, then copy all the missing the config/initializers/ files from the test application to your branched application such as the session_store.rb, then copy the secret key from the environment.rb file into this file. This is to keep the environment.rb file small, braking parts into the config/initializers/ files

Remember to change your Rails version in your environment.rb file to Rails 2.3.2

rename your application.rb file to application_controller.rb or run

rails:update:application_controller

formatted urls

formatted_ * are no longer supported in the route helper due to using too much memory:

 formatted_users_path(:format => 'xml')  changed to users_path(:format => 'xml')

Internationalization

If you have used the globalization gem, it will no longer be compatible in Rails 2.3. Rails has now built in I18n Internationalization. (read more about internationalization)

The old way:

The new way:

In the config/locales/en.yml file we have the following:

The text is retrieved from these files, as well as if you have other languages such as italian, just create an it.yml file and replace the text with the translated text.

Hope this will help when you migrate to Rails 2.3….

Comments

  • ashes999

    Posted on June 06

    This is an interesting summary of internationalization. I wrote an entire ebook on the internationalization process here: http://www.railsrocket.com/articles/internationalizing-your-rails-application-in-34-languages. It provides more details as to the what and how of internationalization.

Post a comment

Categories:

Tags:

Powered by Mephisto, Valid XHTML 1.1, Valid CSS - Supported by Wave Factory