Getting the controller Name dynamically


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

For e.g. I have a template called Multiple_Choice_Questions which
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


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

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

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
but I am struggling with the following

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

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

Thanks for your help in advance.

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