ruby on rails - No route matches missing required keys: [:id] -


i'm new rails, , editing code written else, may need more in-depth response average person...

i'm running error when run rake: no route matches {:controller=>"users", :action=>"show", :id=>nil, :format=>nil} missing required keys: [:id]

the line appears causing problem this:

<%= link_to("my account", user_path(current_user)) %>

the link works correctly on localhost, failing test @ line "render :template":

it "renders new initiative form"   assign(:initiative, initiative.new(location: location.new,rewards:     [factorygirl.create(:reward)]))   render :template => "initiatives/new.html.erb" (...etc.) 

not sure else helpful include here, userscontroller is:

class userscontroller < applicationcontroller   def show      @user = user.find(params[:id])   end end 

and results rake routes:

    `batch_action_admin_users post     /admin/users/batch_action(.:format)             admin/users#batch_action                  admin_users      /admin/users(.:format)                          admin/users#index                              post     /admin/users(.:format)                          admin/users#create               new_admin_user      /admin/users/new(.:format)                      admin/users#new              edit_admin_user      /admin/users/:id/edit(.:format)                 admin/users#edit                   admin_user      /admin/users/:id(.:format)                      admin/users#show                              patch    /admin/users/:id(.:format)                      admin/users#update                              put      /admin/users/:id(.:format)                      admin/users#update                              delete   /admin/users/:id(.:format)                      admin/users#destroy  batch_action_admin_comments post     /admin/comments/batch_action(.:format)          admin/comments#batch_action               admin_comments      /admin/comments(.:format)                       admin/comments#index                              post     /admin/comments(.:format)                       admin/comments#create                admin_comment      /admin/comments/:id(.:format)                   admin/comments#show             new_user_session      /users/sign_in(.:format)                        devise/sessions#new                 user_session post     /users/sign_in(.:format)                        devise/sessions#create         destroy_user_session delete   /users/sign_out(.:format)                       devise/sessions#destroy      user_omniauth_authorize get|post /users/auth/:provider(.:format)                 omniauth_callbacks#passthru {:provider=>/twitter|facebook/}       user_omniauth_callback get|post /users/auth/:action/callback(.:format)          omniauth_callbacks#(?-mix:twitter|facebook)                user_password post     /users/password(.:format)                       devise/passwords#create            new_user_password      /users/password/new(.:format)                   devise/passwords#new           edit_user_password      /users/password/edit(.:format)                  devise/passwords#edit                              patch    /users/password(.:format)                       devise/passwords#update                              put      /users/password(.:format)                       devise/passwords#update     cancel_user_registration      /users/cancel(.:format)                         registrations#cancel            user_registration post     /users(.:format)                                registrations#create        new_user_registration      /users/sign_up(.:format)                        registrations#new       edit_user_registration      /users/edit(.:format)                           registrations#edit                              patch    /users(.:format)                                registrations#update                              put      /users(.:format)                                registrations#update                              delete   /users(.:format)                                registrations#destroy                         user      /users/:id(.:format)                            users#show` 

maybe can help?

you should use devise login helper login before render template. https://github.com/plataformatec/devise/wiki/how-to:-test-with-capybara


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -