hi guys,

 I have a resource, "parts". Another resource, "fits" relates to
"parts".

config/routes.rb
---------------------


ActionController::Routing::Routes.draw do |map|
  map.resources :parts, :has_many => :image
  map.resources :parts, :has_many => :fits
   ...
  map.connect 'get_vehicles', :controller => "parts" , :action =>
'get_vehicles'
  map.connect 'get_subcategories', :controller => "parts" , :action =>
'get_subcategories'

  map.root :controller => "home"
end


running rake routes gives the output below:
=================================

                     parts GET    /parts
(.:format)
{:action=>"index", :controller=>"parts"}
                           POST   /parts
(.:format)
{:action=>"create", :controller=>"parts"}
                  new_part GET    /parts/new
(.:format)
{:action=>"new", :controller=>"parts"}
                 edit_part GET    /parts/:id/edit
(.:format)
{:action=>"edit", :controller=>"parts"}
                      part GET    /parts/:id
(.:format)
{:action=>"show", :controller=>"parts"}
                           PUT    /parts/:id
(.:format)
{:action=>"update", :controller=>"parts"}
                           DELETE /parts/:id
(.:format)
{:action=>"destroy", :controller=>"parts"}
                 part_fits GET    /parts/:part_id/fits
(.:format)
{:action=>"index", :controller=>"fits"}
                           POST   /parts/:part_id/fits
(.:format)
{:action=>"create", :controller=>"fits"}
              new_part_fit GET    /parts/:part_id/fits/new
(.:format)
{:action=>"new", :controller=>"fits"}
             edit_part_fit GET    /parts/:part_id/fits/:id/edit
(.:format)                    {:action=>"edit", :controller=>"fits"}
                  part_fit GET    /parts/:part_id/fits/:id
(.:format)
{:action=>"show", :controller=>"fits"}
                           PUT    /parts/:part_id/fits/:id
(.:format)
{:action=>"update", :controller=>"fits"}
                           DELETE /parts/:part_id/fits/:id
(.:format)
{:action=>"destroy", :controller=>"fits"}

                           POST   /
get_vehicles
{:action=>"get_vehicles", :controller=>"fits"}
          ...

Showing all Routes
  ...
- /get_subcategories/
  ...

Controller: controllers/parts_controller.erb (extract)
------------------------------------------------
  ...
  def get_vehicles
    @make = Make.find(params
[:make_id])
    @vehicles =
@make.vehicles.all;
 
end
 ...






When i access "http://localhost:3000/parts/2/fits/new"; which runs a
partial which uses get_vehicles,
I run into this error of "No route matches {:action=>"get_vehicles"}".

My other resources work without problem with the same set up but with
a nested setup (ie. parts/<parts id>/fits/), rails' routing doesn't
work as expected.

Has anyone come across this problem?

For the moment, I moved def get_vehicles into the fits_controller.erb
but i would still like to find out how to keep def get_vehicles in the
parts_controller.erb...


thanks :)


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to