getting the url helpers to include parent resource params when optional but present

3 views
Skip to first unread message

robguthrie

unread,
Jul 27, 2010, 12:02:56 AM7/27/10
to Searchlogic
Hello,

I am using the following line in my IR derrived controller lets call
it CupsController

class CupsController < CommonController
inherit_resources
belongs_to :person, :optional => true #just this line
that matters
end

When I use the resource url helper methods I want to get a link with
the person in the url if there is a @person var present. (ie: IR found
the parent resource)
So that my link will be /people/45/cups/4 if there was a person and
cups/4 if there was not a person.

currently i just get a cups/:id url unless i set optional to false.
But I really do want it to be optional.

Did I explain myself properly? Is there a recommened way to do this?

Thanks for your time
Rob
Reply all
Reply to author
Forward
0 new messages