faithfulgeek.org

Agile web development

My First Rails Problem

September 24th, 2007

I’ve been working on a Rails pet project for the past couple months. Last night I began implementing ActiveScaffold for my management pages; I was previously using basic scaffolding. After looking at ActiveScaffold I was fairly impressed: it looked easy to implement, customize, and has a nice interface not to mention ease-of-use. I brought it down into my project, added the required code, and EXPLOSION!

Disclaimer: I really tried to troubleshoot this problem, and would love to be able to say I knew the issue to help others avoid it in the future. However, the only help this post will be is relating to someone else with the issue. Perhaps the same thing that worked for me will work for you, but YMMV.

Anyway, the original explosion happened because I forgot to delete my existing scaffolding code. I did this immediately and still had problems. The framework was executing my controller and running the Index action, but then looking to render the list view (as is the default with classic scaffolding), resulting in:

(No such file or directory – script/../config/../app/views/projects/list.rhtml) in app/views/projects/list.rhtml

However, I had deleted all code from the controller save for the active_scaffold line. So yeah, wtf? I tried everything I could think of: redefining Index, undefining Index, deleting session files in app_root/tmp, deleting cache files (which didn’t exist); nothing helped. Finally, after about 3-4 hours of unsuccessful searches on “rails caching problem index action” or “index.rhtml” on activescaffold.com, I decided to debug through the active_scaffold method called from my controller. Everything appeared okay, and by some miracle when the debugger finished I had a working page!

Very weird, and I can remember receiving phantom errors like this in ASP.NET. I hoped I was done with weird shit like that; perhaps this was just a fluke. Anyone else have strange problems like this in Ruby on Rails? Let me know in comments!

Leave a Reply