Ruby on Rails: Why Won’t You Work?

Mon 5 Dec 2005 3:12am

I’ve been trying to get into Ruby on Rails lately. I purchased the PragProg book and read through it. After reading about it, I was really excited by the beautifully elegant system that they have set up for building webapps. Building them very quickly. I even tried a few examples and they worked like a charm. I was only mildly deterred by not ever having programmed in Ruby before, and I quickly picked up the general syntax (which is very loose anyway). No problems whatsoever.

No problems, that is, until I tried to program my own app. Any application of sufficient complexity will need a one-to-many association (for the most part). A person has many comments. An order has many items. However, every time I get to the model associations in Rails, it always chokes and dies. I’ll get bizarre errors from the ActiveRecord controller like trying to write class instance strings in the SQL call, or not writing anything in the SQL call, etc. What’s more, the more I try to debug, the worse it gets. I’m now 99.99(repeating)% positive that there is nothing wrong with the way I’m defining my relationships. Nothing helps. I’ve probably spent a combined total of 12+ hours between the two apps I’ve tried banging my head against a wall or an IRC channel. I haven’t found anyone who can tell my what is wrong. The usual reaction: “Huh … weird.”

This is not helped by the fact that documentation for Rails is pretty poor. Searching online will get you either overly simple tutorials (that actually do things wrong) or the full API reference. The PragProg book on Rails is pretty good, but it’s organized more as an introduction to Rails than a reference or troubleshooting resource. In addition, I develop on a Windows machine, and apparently most other Rails folks don’t, so I’m not even sure if Windows is really supported. (Believe me, if I had a Linux dev box set up, I’d be developing on that instead.)

I’m just about ready to throw in the towel and walk away from Rails. What was supposed to be an elegant and simple framework has turned into an unresponsive and nonsensical beast which nobody seems to understand. Maybe I’ll look into Turbogears for my rapid development needs. At least I’ll be comfortable with the syntax right off the bat.

Comments (5 So Far)

1
Steven Chan says:
Mon 5 Dec 2005 - 4:47am

Found your blog on Technorati. :)

I’ve also tried using Turbogears for my own web apps after getting a little frustrated with Rails (primarily b/c of my unfamiliarity with Ruby). Let’s just say the database back-end is a lot more saner and comfortably takes care of your relationships. Plus, you don’t have to write SQL. I was taken aback at first by this, but Turbogears’ use of SQLobject feels so clean that I didn’t want to go back to Rails.

2
raichu says:
Mon 5 Dec 2005 - 7:27am

maybe you can publish the relevant parts of the code. you might have missed some weird ror convention. ror is quite draconian with regards to naming and placement that at times it feels less like a framework and more of a cookie cutter.

you may also want to post about the code that have worked so far.

also, since your article hints that you still don’t know ruby’s full syntax, there’s also the possibility that your expectations of syntax leniency in one area may have conflicted with that of ruby. in elliot rusty harold’s rails walk (elharo.com/blog/software-development/2005/12/03/birds-on-rails-part-3/), he made the mistake of calling a function instead of concatenating two strings, probably because he still wasn’t too familiar with ruby’s syntax.

3
Sean says:
Mon 5 Dec 2005 - 5:31pm

Update: My friend Matt Colyer has been helping me debug my apps and we’ve at least fixed one of them. (Ended up being a combination of an incorrect column name in custom SQL and a bad session entry that essentially corrupted the session file? We think?) However, my original and larger app still has bizarre errors that we haven’t been able to figure out yet. Starting over from scratch might be the best option at this point…

I do like Rails though. It’s beautifully elegant when it decides to work. I wouldn’t be so frustrated if my largest project didn’t have this strange and crippling bug with the model interaction.

4
smatt says:
Fri 6 Jan 2006 - 7:11pm

glad to know i wasn’t the only one.

5
Mason Browne says:
Sun 8 Jan 2006 - 12:04am

Friend from Billings pointed me at your site. I’ve also recently been looking at different frameworks for development; PHP just isn’t cutting it anymore. If you’re interested, there was a recent Presentation/Q&A from the guys behind Django (the Python web-framework) and Rails. It’s kind of cool seeing the creators of the two frameworks talk, especially when the languages of the respective frameworks have somewhat of a (healthy) rivalry themselves. You can download the audio/video here: http://www.djangoproject.com/snakesandrubies/

Make a Comment

Sean McBride
Engineer / Web Developer
Boston, MA - Billings, MT

"Your mom goes to college."

Subscribe to My RSS Feed