Sunday, August 23, 2009

Migration : Migrating an Application from Rails 1.2.5 to Rails 2.3.3

Since Nov 2007, I had a Rails 1.2 e-CRM application running on Windows Server 2003 and powered by Apache 2 and a pack of Mongrels web servers.

A couple of weeks ago, I discovered Ubuntu 9.04 and decided to migrate the e-CRM to Rails 2.3.3 running on Ubuntu 9.04.

What have I achieved thus far ?

1. Installing Rails 2.3.3 on Ubuntu 9.04
2. Installing Mongrel, Capistrano, Passenger and Apache on Ubuntu 9.04.
3. Installing Aptana Radrails on Ubuntu 9.04
4. Since Aptana Radrails was slow, I then installed Eclipse Ganymade (3.4.2) and managed to install the latest Aptana Radrails .1.30 as a plugin to Eclipse

When I attempted to run e-CRM on Rails 1.2, I ran into a number of incompatibilities including the need to update the following Rails Plugins

1. active_scaffold
2. active_scaffold_export
3. active_scaffold_tools (still unable to get a version compatible with Rails 2.3.3)
4. role_requirement
5. use restful_authentication instead of acts_as_authenticated
6. record_select
7. acts_as_audited

Then after wasting a couple of days, I discovered that Ubunti 9.04 being a Linux distro is case-sensitive and I had to pay attention to renaming the images files in the public\images folder.

Also, I used this script (command line) to auto-convert my rhtml files to html.erb as recommended for Rails 2.x

for f in $(find . -name '*.rhtml') ; do c=$(dirname $f)/$(basename $f .rhtml).html.erb ; mv $f $c ; done

Why the need to change rhtml to html.erb ?

Apparently in Rails 2.x, it’s been revealed that the .rhtml and .rxml file extensions will be deprecated in favor of .erb and .builder, respectively.
Why such a change – well, .rhtml files are not strictly html files. They are generic embedded ruby files that can be used for email templates, csv files, vcards etc… .erb is just a more generic, accurate extension for the file type. The same goes for .rxml – it can be used for more than just xml files. Think of all the rss feeds you’ve written with rxml files. Now you can stop being tied down by the limited .rxml file extension and can start using .builder.
FYI, the ‘old’ extensions won’t be fully deprecated until Rails 3.0.


BTW, this site was also useful reference in my quest to upgrade from Rails 1.2 to 2.3.3

Some additional plugins needed by active_scaffold include

a) in_place_editing - git://github.com/rails/in_place_editing.git
b) render_component


More to come...

1 comment:

Julian said...

Other tidbits I can share:

Gmail changes: tls is now built-in (needs Ruby 1.8.7)
http://www.justinball.com/2009/06/25/sending-email-with-ruby-on-rails-2-3-2-and-gmail/

Disable forgery protection for test

render_partial is deprecated

Welcome to Rails.. Rails... Rails !

In 1995, I started the popular Clipper...Clipper... Clipper website (no blogs then) which was very popular and linked by virtually every Clipper-related site. When I switched to Windows via Delphi in 1997, I started the Delphi... Delphi... Delphi site. In June 2007, I discovered Ruby on Rails and no prize for guessing what I am gonna name this blog. which I started on 2nd October 2007.

As at 10th June 2010, we have 13,364 unique visitors from more than 84 countries such as Angola, Andorra, Argentina, Australia, Austria, Algeria,Barbados, Bosnia and Herzogovina, Belgium, Brazil, Bulgaria, Bangladesh, Belarus, Bolivia, Chile, Cambodia, Cape Vede, Canada, China, Colombia, Costa Rica, Croatia, Cyprus, Czech Republic, Denmark, Egypt, Estonia, Finland, France, Guadeloupe, Guatemala, Germany, Greece, Hong Kong, Hungary, India, Indonesia, Ireland, Israel, Italy, Japan, Kenya, Korea, Lithuania, Latvia, Malaysia, Mexico, Macao, Netherlands, Nepal, Norway, New Zealand, Oman, Panama, Peru, Poland, Portugal,Paraguay , Philippines, Romania, Russian Federation, Saudi Arabia, Singapore, Spain, Slovakia, Slovenia, Serbia, South Korea, Slovenia, South Africa, Spain, Switzerland, Sri Lanka, Sweden, Taiwan, Thailand, Turkey, United Arab Emirates, Ukraine, USA, UK, Venezuela, Vietnam

CCH
10th June 2010, 19:42