On 14 April 2010 16:19, RichardOnRails
<[email protected]> wrote:
> I've got two entities created by scaffolding: Expense & Vendor
>
> In Expense#new there's a form with a Vendors-drop-down and a NewVendor-
> button.
> The latter button brings up Vendor#new.
> The Create button in Vendor#new brings up Vendor#show with Edit & Back
> links.
>
> I want to append a third link conditionally to Vendor#show: if the
> Expense#new form led to the Vendor#show display,  I want a
> "Return:Expense/New" link to accompany the Edit & Back links.
>
> Is there a "Rails Way" to do this?

You can set a flag in the controller at the point you know that you
want to show the link
@show_return_link = true
Then test this in the view to see whether to show the link or not
<%= link_to ....  if @show_return_link %>

Colin

>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to