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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -