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
def resource
@resource || @user ||=
def devise_mapping
@devise_mapping ||= Devise.mappings[:user]

And also added:
def after_sign_in_path_for(resource)
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,
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
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.