# Variables in URLs. Routes manipulation

**URL:** <https://www.ruby-forum.com/t/variables-in-urls-routes-manipulation/174347>\
**Category:** Rails\
**Created:** [August 25, 2009, 12:47pm UTC](https://www.ruby-forum.com/t/variables-in-urls-routes-manipulation/174347 "2009-08-25T12:47:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kinunt](https://www.ruby-forum.com/u/kinunt)\
**Post date:** [August 25, 2009, 12:47pm UTC](https://www.ruby-forum.com/t/variables-in-urls-routes-manipulation/174347/1 "2009-08-25T12:47:15Z")

</div>

Hi,

I have invoices, each belonging to different fiscal years. When browsing  
my app you are navigation seeing information about the current fiscal  
year but I would like to allow the users to change to another fiscal  
year and browse the same way through old information.  
I’ve been considering storing the fiscal\_year in session and use a  
default\_scope to query for invoices from the fiscal\_year the user is  
browsing. But someone adviced me to put the fiscal\_year variable in the  
URL in order to allow navigation in different fiscal\_years for one user  
at the same time.  
How can I implement this feature? The idea is browsing always a URL like

[http://localhost:3000/2009/invoices/new](http://localhost:3000/2009/invoices/new) or  
[http://localhost:3000/2009/invoices/search](http://localhost:3000/2009/invoices/search) → [http://localhost:3000/](http://localhost:3000/)\<%=  
session[:fiscal\_year] %\>/controller/action/id

Is it possible? Would it be restful? Where can I find more info about  
implementing this? The links will work the same after implementing this  
solution? Do you recommend any other solution?

Thanks.

---

<div class="post-metadata">

**Author:** ![kinunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kinunt](https://www.ruby-forum.com/u/kinunt)\
**Post date:** [August 25, 2009, 1:28pm UTC](https://www.ruby-forum.com/t/variables-in-urls-routes-manipulation/174347/2 "2009-08-25T13:28:41Z")

</div>

The links would work as you intend to as long as the routes are fine.  
Thanks & Regards,  
Dhruva S…

Stephen  
Leacock[http://www.brainyquote.com/quotes/authors/s/stephen\_leacock.html](http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html)

- “I detest life-insurance agents: they always argue that I shall some  
day  
die, which is not so.”

On Tue, Aug 25, 2009 at 4:17 PM, Juan K. \<
