Aaron Blohowiak on 6 Mar 2008 16:47:00 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] refactoring controllers


put the common code in a module that you then include in both controllers. this lets your controllers share code without having to do any redirects or what have you from the client perspective.


On Thu, Mar 6, 2008 at 4:31 PM, Chris Cera <chris@cera.us> wrote:
Hi everyone,

I'm looking to extract one scope from my controller into another
controller.  I think I'm missing something design-wise, so I
would appreciate some help.  Here are the options I see so far:

1) Create another controller.  I tried this approach and called
redirect_to() to the other controller.  What I dislike about this
approach is that it sends a 302 back to the client, and generates
another request to the web server.

2) Put it into model.  Aside from the fact that this seems
wrong, I need to restart rails whenever I modify one of our
classes in model.  Is that normal btw?

3) Put it into our library outside of rails.  I dislike this
again b/c of the restart.

I found some useful ideas from this page on refactoring
controllers, but my question still remains:
   http://railsforum.com/viewtopic.php?pid=6561

Any help is greatly appreciated.  Best, -Chris

--
Christopher D. Cera, CTO
http://vuzit.com
P: 215.435.2289
F: 267.295.7369
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk


_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk