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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 6, '11 at 9:50a
activeDec 6, '11 at 9:50a
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Alex Meyer: 1 post

People

Translate

site design / logo © 2022 Grokbase