ruby on rails - Error trying to logout: Couldn't find User with 'id'=sign_out -


i'm getting error when try logout user. checked many posts of same error no 1 solved error, hope can me.

the error follows:

    activerecord::recordnotfound in userscontroller#destroy  couldn't find user 'id'=sign_out 

the following code:

users_controller.rb

    def destroy       @user.destroy       respond_to |format|         format.html { redirect_to unauthenticated_root_path }         format.json { head :no_content }       end     end      private      private     # use callbacks share common setup or constraints between actions.     def set_user       @user = user.find(params[:id])     end 

view/users/index.html.erb

<li>     <%= link_to "logout", destroy_user_session_path, :method => :delete %>   </li> 

routes.rb

    rails.application.routes.draw   'admin/index'    resources :contacts    resources :afections    resources :injuries    resources :allergies    resources :trainers    resources :idusuarios    resources :diseases    resources :weights    resources :diets    resources :exercices    resources :profiles    resources :users    devise_for :users    '/users/sign_out' => 'devise/sessions#destroy'    devise_scope :user     authenticated :user       root 'pagina#index', as: :authenticated_root     end      unauthenticated       root 'devise/sessions#new', as: :unauthenticated_root     end   end end 

move get '/users/sign_out' => 'devise/sessions#destroy' above resources :users in routes. routes given priority in terms of order in routes file.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -