ruby - In Rails, is map.resources now obsolete? -


i viewing episode in railscasts , looking @ source code episode 145.

this code routes.rb file

actioncontroller::routing::routes.draw |map|   map.resources :orders    map.current_cart 'cart', :controller => 'carts', :action => 'show', :id => 'current'    map.resources :line_items   map.resources :carts   map.resources :products   map.resources :categories   map.root :products end 

i thrown off. looked entirely different syntax. realized source code published in 2010. i'm wondering if it's obsolete, because copied , pasted code rails application , isn't working.

usually, is

resources 'orders' root 'products' 

i don't know how rewrite map.current_cart.

this error message get

nameerror at/orders/new undefined local variable or method 'map' #<actiondispatch::routing::mapper::0x4d90868> 

this line highlighted

  map.current_cart 'cart', :controller => 'carts', :action => 'show', :id => 'current' 

yes obsolete now.

instead of map.resources use resources.

so should write resources :orders


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -