ruby - Rails: ActionController::RoutingError No route matches error -
i have search controller (no model) running query against users table. works fine, once enter
<%= link_to "good proceed now.", new_user_product_path, :class => "btn" %>
it gives me
actioncontroller::routingerror (no route matches {:action=>"new", :controller=>"products"}):
i have relationship estbalished between user , product model. able access products#new
when directly go link http://127.0.0.1:3000/users/3/products/new
. again, when link_to snippet entered, gives above error.
my search controller isnt tied db, helps me process front end.
what doing wrong here? there need routes?
here routes file
resources :searches, only: [:index, :create] resources :users resources :products end
you need pass user new_user_product_path
.
so like:
new_user_product_path(@user)
or new_user_product_path(current_user)
Comments
Post a Comment