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?
Flash is a mechanism for displaying text onto the view. If you want to
“store” other types of data, you should use either a cookie or the
session.
Actually the flash isn’t magic at all. It’s just a hash which is
auomatically emptied at the right time (and it is actually stored in
the session).
It’s commonly used for passing strings around, but I don’t see why you
couldn’t stick in it anything you could stick in the session.
I guess perhaps I asked the wrong question–the real question here is
how do you retrieve the page that is associated with the array of
articles again when the user is done editing?
I’ve tried this:
I’ve defined a page_id method in the article model.
def self.page_id
Article.page_id
end
Then in the edit action in the articles controller,