So I’ve built a page controller that lists pages, with a link to edit
When you click the edit button, the edit view lists the page title and
the associated articles with that page, using:
(in the controller)
@articles_pages, @articles = paginate(:articles, :conditions=>
[‘page_id = ?’, @page])
Article is a separate model with a belongs_to :page in its model and a
foreign key page_id.
The trouble comes when the user clicks on the Edit Article link. It
opens up the edit view and displays the article, with the following
<% form_tag :action => ‘update’, :id => @article do %>
<%= render :partial => ‘article_form’ %>
<%= submit_tag ‘Edit’ %>
<% end %>
<%= link_to ‘Show’, :action => ‘show’, :id => @article %> |
<%= link_to ‘Back’, :action => ‘edit_page’, :id=>@page.id %>
The last line is the problem. I need some way for the application to
remember which page is associated with the article and return the user
to editing the page from the edit article form.
I’m not sure if I should pass a param here or store the id in flash?