I am working on a web on rails and have been having issues logging into facebook. The error I get is
Couldn't find User with 'id'=2
My index.html.erb (where the login in happening), the relevant code is as follows:
<% if current_user %>
Signed in as <strong><%= current_user.name %></strong>!
<%= link_to "Sign out", signout_path, id: "sign_out" %>
<% else %>
<% end %>
In my application controller I have:
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
I referred to this question but I just get redirected to the homepage (index) without actually being logged in. What is going wrong here?
Aucun commentaire:
Enregistrer un commentaire