hotsh/rstat.us — Issue #448: SubscriptionsController#create gets a double render error in some case
Author: clnclarinet
Created: 2012-01-14 04:55:28+00:00
State: open

In newrelic i'm seeing:

SubscriptionsController#create raisedAbstractController::DoubleRenderError

at:

app/controllers/subscriptions_controller.rb: 120

This controller action is pretty confusing, so I'm not surprised.

If anyone wants to pick this up, this would be a fun refactoring-- I'd recommend moving the finding of the feed parts (roughly L72-96) into a class method on Feed that could then have unit tests for all the cases.

Then it'll be easier to set up acceptance tests for the other half of the action (it's basically controller logic after that, but it does seem like an awful lot of it so if there's a good way to get rid of more of it that's cool too)

I'd recommend setting up nested if/else cases instead of ifs and unlesses at the same level; that will actually get rid of the double render error. I prefer that to throwing explicit returns in...