Clean way for a modular rails app?

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

Try http://agilewebdevelopment.com/plugins/embedded_actions

Just like the traditional render :partial, embedded actions allow you
to
refactor your views and extract presentation logic and templates into
separate
files.

Unlike partials, embedded actions also let you define business logic
to be
performed before the partial is included. That logic is encapsulated
in the
already well understood metaphor of an action inside a controller.

So a simple call like

<%= embed_action :controller => "songs", :action => "top10" %>