I am having issues trying to redirect a user to a user show page after they successfully sign in using devise for rails. So far I have tried the following suggestions:
Changed devise_for to route to users show this way:
devise_for :user do
root :to => "users#show"
end
Changed devise_for to route to users show this way:
devise_for :users do
get 'users', :to => 'users#show', :as => :user_root
end
Even tried rerouting using:
match '/user' => "users#show", :as => :user_root
I also overwrote the registrations controller.
The error message I get after successful sign in is:
Couldn’t find User without an ID.
My users controller is set up as follows:
class UsersController < ApplicationController
before_filter :authenticate_user!
def show
@user = User.find(params[:id])
end
end
Am I just missing something here? Any help would greatly be appreciated. Thanks!
Figured it out. I needed to overwrite the devise code for after_sign_in_path in the applications controller. I did this with:
end