Proper way to route 'date' urls using simply_restful

What is the proper way to set-up routing for a url like ‘/blog/2006/10’
(/blog/year/month) using the simply_restful support in edge rails? I’m
trying to keep everything within the confines of REST, but I need to be
able to paginate through months in my index view. I’m just not sure how
I should set-up my resource in routes.rb so that it passes the year and
month to my controller.

Any help yoou can give me is totally appreciated.

On 10/29/06, Andrew H. [email protected] wrote:

Posted via


As I understand it you have multiple blogs that you would like to
RESTify but you need another route mapping… just use REST plus one
extra route like this:

map.resources :blogs
map.connect ‘blogs/:year/:month/:day’, :year => nil, :month => nil,
:day => nil, :requirements => { :year => /\d{4}/,
:month => /\d{1,2}/, :day => /\d{1,2}/ }, :controller => ‘blogs’,
:action => ‘index’

Then check in index action for params. If present, add conditions to
Blog.find(…) as needed. Check article_controller.rb in the mephisto
source for a good example of this.

Hope this helps,

Zack C.