Clean way for a modular rails app?


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