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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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" %> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---