Hi all,

I've been struggling with routing for a custom action. I've read some
background on rails routing, and the hobo controller/routes doc, but
still scratching my head.

I have a method defined in the controller

... in controller
class UnitsController < ApplicationController
    def duplicate
        ...
    end
end


... in router
map.duplicate 'duplicate/:id', :controller => 'unit', :action =>
'duplicate'
 - this results in urls formed as http://localhost:3000/duplicate/3
(not routed to controller). If I manually enter the correct URL in the
browser (http://localhost:3000/units/duplicate/3) it works.

If I change it to
map.duplicate 'units/duplicate/:id', :controller => 'unit', :action =>
'duplicate'
links are constructed like http://localhost:3000/units/duplicate/3,
but clicking on them results in:
 NameError in UnitController#duplicate

uninitialized constant UnitController ...


in view (application.dryml)
i've tried:

<def tag="card" for="Unit">
  <card class="unit" param="default" merge>
    <header: param>
       <editor:name if="&!this.verified"/> <%= link_to "Duplicate",
duplicate_path(this.id)  %>
            <collection:unit-versions><empty-message:></empty-
message:></collection>
    </header:>
  </card>
</def>

which results in the links described above.

and also the dryml way:

<def tag="card" for="Unit">
  <card class="unit" param="default" merge>
    <header: param>
       <editor:name if="&!this.verified"/> <a
action="duplicate>Duplicate</a>
            <collection:unit-versions><empty-message:></empty-
message:></collection>
    </header:>
  </card>
</def>

which only results in static text on the page, telling me hobo was
unable to construct a valid route.

I think I am missing something basic here. Any tips?

Thanks

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to