opensource-developer
opensource-developer

Reputation: 3048

How can i find the path helper from specific route i have

I have a specific path helper that works perfectly in rails 2.3 but throws error on rails 3.1.

Here is the path helper.

shipping_price_store_return_path(store)

When i use this in rails 3.1 it gives me error saying

NoMethodError: undefined method `shipping_price_store_return_path' for #<ActionDispatch::Integration::Session:0x007fb2da730228>

when i run rake routes This is whati get shipping_price_store_return_index /stores/:store_id/return/shipping_price(.:format) {:action=>"shipping_price", :controller=>"return"}

can anyone suggest what could be going wrong here.

below are the content of routes file

resources :stores do      
      resources :return do
        match :shipping_price, :on => :collection
      end
end

Upvotes: 0

Views: 53

Answers (1)

Deepesh
Deepesh

Reputation: 6398

As your resource name is :return instead of :returns that Rails decided to add the _index to any collection nested underneath. This change has been done from rails 3 onwards.

So the new rails 3 route should be:

shipping_price_store_return_index_path

If you want to avoid the _index then either you can use resources :returns or you can make it resource :return.

Upvotes: 2

Related Questions