Variables in URLs. Routes manipulation


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 or
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?


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


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

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