June 12th, 2007

So in my last post I bragged of my disregard for David’s railsconf keynote recommendation to stay a bit back from edge rails. This post, instead, I humbly have fallen at the mercy of a meager changeset. In changeset 6922, Jeremy Kemper updated singleton resources to now point to plural controllers rather than singular.

What used to be…

map.resource :logo # => points to LogoController

now is…

map.resource :logo # => points to LogosController

Notice that it points to the plural controller. The change was “so the controller may be reused for multiple nestings or namespaces.” Tonight, I updated my rails trunk and suddenly I could no longer log into an app that I am working on. I’m using a singleton resource for my session controller and each time I tried to login, I would get the following error:

uninitialized constant SessionsController

Cockily, I dove into the routes, thinking that perhaps I could find the newly introduced “bug.” 45 minutes later (routing is CRAZY in rails), I did a simple search on google and found this tumble informing me of the change (who says tumblelogs aren’t important). I’m subscribed to the changesets but somehow 6922 slipped through. Here’s hoping it doesn’t bite you as well.

Posted by jnunemaker in Core

6 Responses to “Edge Rails Bites Back”

  1. I know what you mean about routing. One of the reasons I recently switched to edge was because it looked like map.resources would now accept :conditions which it did not in Rails 1.2.3. Maybe I screwed something up, but I couldn’t get it working properly. I started debugging the issue, but I realized that even in the best case scenario was that I would spend a couple hours familiarizing myself with how all the bits fit together, and then if I uncovered a bug I would have to write a patch and a test case.

    All that might be a good weekend project, but I’ve got deadlines so I just worked around the problem. I also won’t be running svn update on my edge rails checkout until I need a specific new feature.

  2. John – Are you using Piston when freezing to vendor/rails? I don’t know your exact scenario, but Piston may have allowed you to back up a few revisions to get your app back in a functioning state.

    I, too, have been freezing most of my apps against Edge Rails (despite warnings otherwise). Your last post was extremely helpful, thanks.

  3. @Gabe – True, but I have found it easier to stay on edge than to update an older app to edge every 3 or 6 months. Plus, I have to have the newness. :)

    @Patrick – I use my own variation of a pimped rails setup.

  4. It’s worth noting that, while the controller’s name changes to plural, your named routes generated by map.resource :logo will remain singular:

    new_logo_path, edit_logo_path, etc.

  5. Ha! I just updated my edge Rails and got bit by this, and I had this vague recollection of hearing something about it, but I couldn’t remember where. So I trawled Trac Timeline and say changeset 6922 and then I remembered this post. Seriously, my brain remembered that you mentioned that number.

  6. @Gabe – Ha. Glad I could help.

Sorry, comments are closed for this article to ease the burden of pruning spam. If you have any further comments, just send me an email.

About

Authored by John Nunemaker (Noo-neh-maker), a web developer/programmer who has fallen deeply in love with Ruby.

Syndication

Feed IconRailsTips Articles - An assortment of howto's and thoughts on Ruby and Rails.

Feed IconRails Quick Tips - Ruby and Rails related links that I find. Never more than 5 a day.

Search