Cameron Vessey wrote in post #955866:
>
>   So heres were I go dumb again... I added a print_label view to the
> tire view folder ...
>   "map.resources :tires" does nothing for this new view  ....
>  I must force the route into tires?
>>

map.resources :tires

generates the 'standard' CRUD routing.  There are two additional options 
I'll mention (probably should have done it earlier)...

:collection and :member

:collection lets you define additional routes that work on a collection 
of that resource

map.resources :tires, :collection => {:thumbnailed => :get}

would give you

<%= link_to "Thumbnails!", thumbnailed_tires_path %>

targeted at

def thumbnailed
  # your method code here
end

in the tires controller, which by default expects a

thumbnailed.html.erb  view file


:member lets you define additional routes that work on a specific 
instance of the collection

map.resources :tires, :member => {:print_label => :get}

would give you a

<%= link_to "Print a Label", print_label_tire_path(tire) %>

targeted at

def print_label
  # your method code here
end

in the tires controller, which by default expects a

print_label.html.erb  view file.

You can add as many collection and member routes as you like in 
routes.rb

This is all probably better explained at 
http://api.rubyonrails.org/v2.3.8/classes/ActionController/Resources.html 
around the middle of the page.

Remember to restart your server after changing the routes.rb

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to