Using the brand-spanking new map.resources for REST goodness, is there a way to pass in additional parameters, or do I have to go back to standard routes. For example, is there a way to use the map.resources to response to urls like: /blog/2005/02/03/ => :controller => :blog, :action => :show, :year => 2005, :month => ''02'', :day => ''03'' Thanks! -- Posted via http://www.ruby-forum.com/.
I would add a second and non REST route like this: map.index_by_date ''blog/:year/:month/:day'', :controller => ''blog'', :action => ''index'', :year => nil, :month => nil, :day => nil, :requirements => { :year => /\d{4}/, :month => /\d{1,2}/, :day /\d{1,2}/ } Now in your controller index action simply check for the params. If given, filter posts accordingly. Hope this helps, Zack On 8/8/06, Worky <worky.workerson@gmail.com> wrote:> Using the brand-spanking new map.resources for REST goodness, is there a > way to pass in additional parameters, or do I have to go back to > standard routes. For example, is there a way to use the map.resources > to response to urls like: > > /blog/2005/02/03/ => :controller => :blog, :action => :show, :year => > 2005, :month => ''02'', :day => ''03'' > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 8/8/06, Worky <worky.workerson@gmail.com> wrote:> Using the brand-spanking new map.resources for REST goodness, is there a > way to pass in additional parameters, or do I have to go back to > standard routes. For example, is there a way to use the map.resources > to response to urls like: > > /blog/2005/02/03/ => :controller => :blog, :action => :show, :year => > 2005, :month => ''02'', :day => ''03'' > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Two articles that ought to help: http://www.jvoorhis.com/articles/2006/07/28/howto-make-simply_restful-useful-for-real-people and the more recent http://www.jvoorhis.com/articles/2006/08/01/announcing-resource_hacks