0

In my routes.rb I have:

resources :fire_preventions do
   get 'search_adv', :on => :collection
end

How can I use it with inherited resources routes?

search_adv_collection_url doesn't work.

Mischa
  • 42,876
  • 8
  • 99
  • 111
Mauro
  • 1
  • 1

2 Answers2

1

You can execute rake routes in comand line. It will print all available paths according to routes.rb

Kir
  • 7,981
  • 12
  • 52
  • 69
  • I know but I want to use inherited resources url helpers with nested resources. – Mauro May 11 '11 at 11:17
  • Please, explain or show your code sample of nested resource. Routes listed above are not nested. – Kir May 11 '11 at 11:20
0

As there is only one route listed,

resources :fire_preventions do 
  get 'search_adv', :on => :collection 
end

is shorten form for getting rid of the additional block

resources :fire_preventions do 
  collection do
    get 'search_adv'
  end
end

You should be able to use search_adv_fire_preventions_path and search_adv_fire_preventions_url. It's best that you perform rake routes to check this.

Michael De Silva
  • 3,808
  • 1
  • 20
  • 24
  • search_adv_fire_preventions_url works but I want to use url helpers from inherited resources and search_adv_collection_url doesn't work. – Mauro May 11 '11 at 11:11
  • Have you looked at these [examples](https://github.com/josevalim/inherited_resources)? Seems the `collection_url` helper is context sensitive. Also, see this [screencast](http://asciicasts.com/episodes/230-inherited-resources) if you haven't already. – Michael De Silva May 11 '11 at 11:28