I have a project that's been stable and in production for some time, but I now want to add some features to and 'modernize' a bit. Because it's been stable there's been no need to keep up with Rails as it's progressed, but now that I'm looking to add on, I'd like to use some of the new Rails goodness. So what I've chronicled here is what I needed to do to move a project from Rails 1.2.0 to 2.3.2.
There is nothing special about the application, it's basically a lot of CRUD in an admin interface, a simple signup/registration page, some photo galleries and a mass mailer; it's for a night club promoter.
When I developed this, I pinned a revision number of the edge svn repository as an external dependency in my local svn, as Rails moved to Git some time ago, this was the first thing that needed to be addressed. I also would be moving from a Apache mod_proxy/Mongrel deployment to a Phusion Passenger deployment, so my current Capistrano deploy.rb file was basically worthless. After a little thinking about approach, I just decided to bite the bullet and start a new Rails 2.3.2 project under Git and migrate the codebase.
So after doing a little Git housekeeping (mostly setting up the .gitignore file), I copied over the /app directory, my config/routes.rb and my contributions to /public and ran rake db:migrate. Then the moment of truth, running script/server; drum roll please -- the app booted fine! I was truely surprised.
After my inital shock though, I started clicking and then things started breaking -- which I expected. First up, none of my filters were working, in fact any call to them promplty crashed the app. Low and behold, application.rb is now called application_controller.rb ... copy and paste my filters, delete my application.rb file, woo hoo, I can get to admin now!
Next up, complaints that method paginate is not found. Hmm, a little googling tells me that's because pagination has been removed from rails core. A little more searching and I found myself installing the will_paginate plugin and editing about 6 controller/view pairs updating the syntax.
The bombs keep on coming, now auto complete methods are failing ... again a removal from rails core and the auto_complete plugin come to the rescue; this time with no syntax changes.
Onto playing with the CRUD ... Oops, have some deprecated/discontinued start_form_tag / end_form_tag constructs. 3 more views edited.
Photos are a big part of this site, both in the current news for the front page as flyers and in the galleries showing in situ shots of folks at events. I originally developed using the file_column plugin. I'd already made a mental note that 'phase II' of this conversion would be to swap out file_column for attachment_fu because file_column is no longer under development, but I really didn't want to combine that project now. When I when to test the image functionality I feared I might have to, loading an image page threw as file_column error about a bad call to an Inflector method. Again Google to the rescue; seems Active Support has had some changes and I needed to patch the plugin. Fortunately, others have blazed this trail before and I found what I needed, an explicit namespace call to ActiveSupport::Inflector (found here).
After all those gyrations, the only thing left to do was fix Capistrano and my deployment recipe. This also turned out to be quite simple, change the :scm to :git, point at repository and execute a 'touch' command to tmp/restart.txt instead of my mongrel_cluster command.
Lot's of nits, no real pain in this migration. All for now.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment