When using nested resource URLs like this: 
http://localhost:4000/clients/1/trips/1/elements

to make a link like that I use: <%= link_to "Cancel", resource
( @client, @trip, :elements ) %>
(Explicitly specifying the client and trip to build the url)

This means every action in the controllers has to derive @client and
@trip like this if I want to generate links in the view:

    @trip = Trip.get( params[:trip_id] )
    @client = Client.get( params[:client_id] )

This seems like a lot of repeated code. Is there a simpler, shorter
(more automated) way to generate resource URLs?

For example, just use <%= link_to "Cancel", resource( :elements ) %>
and it figures out the url "context" by itself?

Is this a job for a helper method? Named routes? Other?

Cheers,

George
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to