Forum: Ruby on Rails grabbing date out of url path for use as param i.e. /entries/01/2009

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
708000cf4928013787823c10427136fc?d=identicon&s=25 ressister (Guest)
on 2009-01-12 15:29
(Received via mailing list)
Hi there,

I have been working on what i would describe as a "view selector," a
DHTML drop-down menu that allows a user to view entries by criteria
such as: All, Uncategorized, or by month where the user has entries.

If a user select "January" from the drop-down, the view is refreshed
and the URL path looks like this "/entries/01/2009."

Within all views, the user has the ability to edit an entry which is
performed as an Ajax request.  When the user edits an entry, the view
context is lost - i.e. if the user was in the January view and edits
an entry, post request, all entries are shown.

I was expecting to have access to the month and year is the URL i.e.
01 and 2009 without having to do any work.  Do I have to explicitly
define them as part of the edit form to have access to them in my
controller action so that I can return the user to the select view
after the record is edited?

What's the best way to handle this situation?  To summarize - user
selects "January" as a month from the drop-down.  The user edits a
record in this view.  Post edit, the user needs to be returned to the
same context, not back to viewing all records.  What's the best way to
transfer the user's current view context into the edit method in my
controller so that I can return the user to where they where after
they make the edit?

I look forward to your help and thanks!

-Alex
This topic is locked and can not be replied to.