Following up on what Bob Smith posted on 4/21 and Hassan Schroeder on
4/24,
here's what I've got working:
======= app\views\vendors\show.html.erb =====
[snip]
<%= link_to 'Edit', edit_vendor_path(@vendor) %> | <%# From scaffold -
%>
<%= link_to 'Back', vendors_path %> <%# From scaffold -%>
<%# params['show_new_expense_page'] = true %>
<% if params['show_new_expense_page'] -%>
>
<%= link_to 'New Expense', '/expenses/new' %>
<% end -%>
<% params['show_new_expense_page'] = false %>
============== end ===================
With the "params ... = true" line commented out, I get two links:
Edit | Back
Un-commented, I get three links as desired, and they all work:
Edit | Back | New Expense
My intention is to have the "New Expense" link visible when a
particular link was previously clicked in the following page:
======= app\views\expenses\new.html.erb =====
[snip]
<% @current_vendors =
Vendor.find(:all, :order=>"nickname").collect { |v|
v.nickname + parens(v.qbname) } %>
<%= f.select :vendor, @current_vendors %>
<% params['new_expense_page'] = true -%>
<%= link_to 'New
Vendor', :controller=>'vendors', :action=>'new' %>
[snip]
================= end =================
But the "params ... true" setting is not conveyed to the app\views
\vendors\show.html.erb page.
1. Can this be fixed?
2. If not, will using session rather than params work?
3. Or can I access the "previous page" value in the app\views\vendors
\show.html.erb page and test whether the previous page was app\views
\expenses\new.html.erb?
Again, thanks to all of you for your past responses. I'd be grateful
for any additional ideas you may offer.