# Refactoring Large Controllers

**URL:** <https://www.ruby-forum.com/t/refactoring-large-controllers/140732>\
**Category:** Rails\
**Created:** [June 18, 2008, 1:24am UTC](https://www.ruby-forum.com/t/refactoring-large-controllers/140732 "2008-06-18T01:24:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 18, 2008, 1:24am UTC](https://www.ruby-forum.com/t/refactoring-large-controllers/140732/1 "2008-06-18T01:24:47Z")

</div>

Hi all,

I’ve got a Ruby on Rails application where I render a lot of RJS stuff  
onto a page. Because of this I’ve kept all the logic inside pretty much  
one controller.  
This controller is now pretty big with lots of functions. I was  
wondering what is the best way to refactor it?

I was thinking about moving some methods into a helper module, but it  
seems that helpers are for views only. Can a method even render an RJS  
file?  
What else can I do?

Thanks.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 18, 2008, 3:14am UTC](https://www.ruby-forum.com/t/refactoring-large-controllers/140732/2 "2008-06-18T03:14:31Z")

</div>

If you have lots of well-factored private methods in your controller,  
they’re good candidates to be moved into a model class or some other  
class. My buddy, Zach D., put together a nice tutorial for  
RailsConf entitled, “Refactoring Your Rails Application.” It was  
well-received. More info here:

[http://continuousthinking.com/2008/6/3/refactoring-your-rails-application-tutorial-content](http://continuousthinking.com/2008/6/3/refactoring-your-rails-application-tutorial-content)

Craig

On Tue, Jun 17, 2008 at 6:24 PM, Greg L.
