I want to redefine the user creation in Devise in a way that allows me to transfer data from a Guest
user to the created user.
Can I just override the new
and create
methods in my UsersController
as such
def new
@user = user.new
end
def create
@user = User.new(user_params)
#method to move data from Guest to new User
@user.create
end
and then create a new.html.haml
form_for
that takes the user's email and password? Will doing this mess up any sort of Devise security features, etc?
It is common practice to override default devise controllers and add custom functionality to them. I think it will feet you needs of transferring data from guest to registered user.
https://github.com/plataformatec/devise#configuring-controllers
This approach is well-documented, and has many refers at StackOverflow.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.