# Clean way for a modular rails app?

**URL:** <https://www.ruby-forum.com/t/clean-way-for-a-modular-rails-app/196533>\
**Category:** Rails\
**Created:** [December 4, 2007, 3:53pm UTC](https://www.ruby-forum.com/t/clean-way-for-a-modular-rails-app/196533 "2007-12-04T15:53:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karine\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e99b99/32.png) [@Karine\_D](https://www.ruby-forum.com/u/Karine_D)\
**Post date:** [December 4, 2007, 3:53pm UTC](https://www.ruby-forum.com/t/clean-way-for-a-modular-rails-app/196533/1 "2007-12-04T15:53:41Z")

</div>

Hello,

Right now, my Rails app has a controller with far too many functions.  
Some of these functions look like:

def generic\_function(params)  
case x  
when “module1”  
return module1\_function(params)  
when “module2”  
return module2\_function(params)  
[…]  
end  
end

I would like to move module1\_function (and all other module1 related  
stuff) in a separate file. Same thing for module2 (in another  
separate file) and so on. What is the proper, clean way to do that?

Thanks,  
Karine
