Devise Troubles

I have been trying to create a rails 3.1.3 app using devise and have
started customizing devise to fit my needs. However, I have run into
a problem when a user edits their information. These two forms are
being rendered in a users show page. I have added this code to the
user controller helper:
def resource_name
:user
end
def resource
@resource || @user ||= User.new
end
def devise_mapping
@devise_mapping ||= Devise.mappings[:user]
end

And also added:
protected
def after_sign_in_path_for(resource)
user_path(resource)
end
to the application controller in order to get the right redirect
needed after a user signs in.

This allowed me to render devise forms in other parts of my site,
like
sign up, sign in, etc. What happens each time I try to edit a users
info is I get the error, “Couldn’t find User without ID”, on the
redirect back to user show page. I know this is happening because
for
whatever reason the controller no longer knows what user is signed
in. Checking the logs shows that the information is updated in my
database correctly and upon going back to the user show page manually
and refreshing it updates the information and says it was done
successfully. Can anyone help point me in the right direction or let
me know what I am missing? Thanks for any help.