Any suggestions on how to do a little patching on a Rails 1.2 app?

Back when the earth was young, I wrote a little app for my brother-in-law to run his in-home tutoring business. It was my first “real” rails app. Written in Rails 1.2. Zero tests. I just looked at the routes.rb file and it is empty, nearly. It’s like I just treated the framework as a convenient safety net instead of a Good Idea. For example, in some of my controllers I have a “list” method that for some reason replaces the index method.

Did I mention there are no tests. Oh yeah: no migrations. I just changed the database by hand and copied it around. Goodness me. The only good thing that I could possibly say about this app is that I can say “I’ve been a Rails developer for 8 years” and it would technically be true, although my current skillset would probably quickly expose me. ha ha

Miraculously, this app has chugged along since 2006, or 2007, when I handed it over to him. About 50 or 60 people use it every week and it handles payroll, and pairing up the tutors and clients.

So, I’m not proud of it, but I can’t forget about it, unfortunately, because people still use it, and my brother in law depends on it.

The problem right now is that emails are not reaching their targets, especially the tutors who need to be notified of potential clients. I use sendgrid, and if anyone has any pointers to troubleshoot this issue, I would appreciate a tip.

Additionally, I want to use Twilio to send a text to tutors when they need to be notified of client opportunities.

So here is my question: I was thinking of just making a pretty thin heroku app to access the legacy database every ten minutes or so with a scheduled rake task and send out the appropriate SMS messages to the tutors based on the information in the database. So my Twilio SMS sender would really have no database except the legacy one in use by the old rails app.

OR I was thinking of regularly copying information to my Twilio heroku app and working with it there. But I don’t like having two versions the same information in two databases. :frowning:

I also need to background the sending of emails, which is another thing I want to offload to this new heroku rails app that interacts with the legacy database. I’m not even sure I could get any background processing working with rails 1.2 and Ruby 1.8.7, and I’m not eager to try.

Sorry for the wall of text, but I value highly this community’s opinion and approach and thought I would see if anyone has anything to warn me about or nudge me towards.



I think they have decent logging that you can go look at. I’d start there.

Beyond that, here’s a great book that talks about dealing with legacy codebases:

I don’t often say this, but it sounds like you might be at the point where a rewrite is the least-painful option.

I just converted a 2.1 to 4.2 without tests. Ben is right on the book. It is a great book.

Here was my approach, which is close to a rewrite. I started a new rails 4.2 project. Then I started writing tests for the models and copied the models from the old project into the new project one by one. Then I wrote feature tests and I brought over one controller and their views, one at a time. Starting with the landing page. Then the login functionality. I ended up having to bring in activerecord-deprecated_finders. The ultimate goal would be to rip these out at some point.

My biggest pain point was the plugins, such as attachment_fu and the app used a lot of ajax via rjs files.

Ultimately it was not a complete rewrite, because I was able to leverage a massive amount of code that was already written. It is still a work in progress because I will still go file by file, to bring it up to my current coding standards, but it runs and has stabilized and sped up the entire application in production by leaps and bounds.

1 Like

thank you, frank. I’m about 75% through a rewrite taking a very similar approach. Which makes the fact that I need to patch this old system even more frustrating; I just can’t afford to wait on it. thank you for reply.