# Grabbing date out of url path for use as param i.e. /entries/01/2009

**URL:** <https://www.ruby-forum.com/t/grabbing-date-out-of-url-path-for-use-as-param-i-e-entries-01-2009/157516>\
**Category:** Rails\
**Created:** [January 12, 2009, 3:29pm UTC](https://www.ruby-forum.com/t/grabbing-date-out-of-url-path-for-use-as-param-i-e-entries-01-2009/157516 "2009-01-12T15:29:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [January 12, 2009, 3:29pm UTC](https://www.ruby-forum.com/t/grabbing-date-out-of-url-path-for-use-as-param-i-e-entries-01-2009/157516/1 "2009-01-12T15:29:47Z")

</div>

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
