Getting the controller Name dynamically.

Hi,

I have a application where I define Templates which are nothing but a full MVC structures.

For e.g. I have a template called Multiple_Choice_Questions which actually corresponds to MultipleChoiceQuestionsController and so on. These values are defined in the DB and there are many templates that are defined.

I am able to instantiate this class model for e.g. using the following snippet

Object::const_get(@section.template.template_class.camelize.singularize)

and I can also put the following in the view to go directly to the controller

<%= link_to content_tag(:span, “New Question”) ,{ :controller => @section.template.template_class.downcase ,:action=>:new, :section=>@section.id } %>

and both of these work perfectly fine.

Now here is my question. In order to segregate these different templates, I plan to move them into individual folder, i.e. for e.g.

MathTemplate:: MultipleChoiceQuestions Controller which would be a controller under the MathTemplate folder.

I can achieve the instantiation using

Object::const_get(MathTemplate).const_get(@section.template.template_class.camelize.singularize) but I am struggling with the following

<%= link_to content_tag(:span, “New Question”) ,{ :controller => @section.template.template_class.downcase ,:action=>:new, :section=>@section.id } %>

What should I put so that the controller is properly recognized.

Thanks for your help in advance.

Ankur