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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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?