Reputation: 27192
ActionController::RoutingError
No route matches {:controller=>"user_prices", :action=>"show".....
This is the error I am getting when I changed my route in my view to:
<td class="show-link"><%= link_to "Show", show_price_path(user_price) %></td>
Which is from my new route:
match "/:id/:product_name/:purchase_date/:price", :to => "user_prices#show", :as => :show_price
What do I have to do so I can use this route to see my user prices?
Upvotes: 0
Views: 140
Reputation: 44932
The route that you are specifying
/:id/:product_name/:purchase_date/:price
requires 4 parameters for it to be created. You are only passing in one object, which I assume is meant to be for the id. With the route that you have specified, you will need to do something like.
show_price_path(:id=>user_price.id, :product_name=>product_name_from_user_price, :purchase_date=>purchase_date_from_user_price, :price=>price_from_user_price)
Upvotes: 4