STI, Namespaces, REST and link_to


i’ve got the STI-hierarchy Dictionary, InternalDictionary < Dictionary
and OnlineDictionary < Dictionary.
Every submodel has its own controller. E.g. InternalDictionary is
handled by
Voc::InternalDictionaryController. As you see everything works inside
the namespace Voc (except the models).

In an index.html.erb of a controller i walk through all types of

<% for dictionary in @dictionaries %>

<%= link_to 'Edit', [:voc,dictionary], :method => :get %> <% end %>

This leads to the path “voc_internal_dictionary” for objecs of type
InternalDictionary and to “voc_online_dictionary” for objects of type
OnlineDictionary. So far so good.

But I want to call the method “edit” or a methodname completely
different from the CRUD-names.I’d need something like

<%= link_to 'Edit', [:voc,dictionary], :action => "edit" %>

I tried:

<%= link_to 'Edit',edit_voc_dictionary_path %> but that doens't behave polymorphic and calls the edit method of the dictionary-controller directly.

Any ideas?

Thanks a lot

back again, I have found an answer meanwhile:

link_to ‘Edit’, polymorphic_url([:voc,dictionary],:action => :edit)

does exactly what I need.