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)

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?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs