how to pass id in controller

206 Views Asked by At

I have this error . I'm using users using Omniauth-identity and Omniauth-FB TWITTER from railscast video.

No route matches [GET] "/users/generators/new"

when i click

<%= link_to 'GENERATE RAPD PRIMER',new_user_generator_path(@user), id:'new' %></li>

What this route does in rake routes is

new_user_generator GET    /users/:user_id/generators/new(.:format)      generators#new

When i click

<%= link_to 'GENERATE RAPD PRIMER',user_generator_results_path(@user), id:'new' %></li>

my URL returns

http://localhost:3000/users//generators/new

There's no id return in that URL. How come ??? How can i fix it? I'm using railscast tutorial about Omniauth FB and Identity for User model. I'm trying to associate User with generator.

1

There are 1 best solutions below

6
On

Make sure you pass user_id param as per routes:

new_user_generator_path(user_id: @user.id)