Re:Rethinking Rails 3 Controllers and Routes - PeepCode Blog
by dkubb on Thursday June 03, 2010 @03:38AM
(#1400744)
Whenever I've tried to reuse the same controller for two URLs, I usually end up with some conditional logic within the controller to handle difference in parameters available from the URL.
I think a better approach would've been for me to subclass one from the other, or have a common parent class, and then handle the parameter differences within each subclass. At that point you'd end up with a 1:1 mapping between controller class and URL anyway.
Re:Rethinking Rails 3 Controllers and Routes - PeepCode Blog
by mikek85 on Monday June 07, 2010 @02:00PM
(#1411210)
That 1:1 mapping is a good thing, but I don't think that's a reason to completely do-away with routing altogether. Sticking the route in the controller just makes the code harder to follow.
Re:Rethinking Rails 3 Controllers and Routes - PeepCode Blog
by binspace on Thursday June 03, 2010 @01:51AM
(#1400525)
I don't understand how a monolithic route mapping layer & a separate resource layer is more reusable than a modular resource + route layer. Care to explain?
I find the Sinatra approach leads to less code and less complexity, especially for larger apps. This is because it is easy to extract middleware using Sinatra, since I break up separate resources anyways, instead of the single Application object.
You don't have to pretend ... it actually is reusable. I don't get what's "over-engineer"ed about it.