mardi 30 décembre 2014

Rails, Devise, Sign up = write name in other Database


Vote count:

0




I use Rails 4 and Devise. I set it up that the user needs to register and sign in with a username instead of a email. Now, as soon as a User signs up I want to write a name in another db which is called Room. So I got the users_controller with the following:



def create
@user = User.new(user_params)

if @user.save
redirect_to @user, notice: 'User was successfully created.'
else
render action: 'new'
end
end


Basically what I want now is that the username which the user enters will be used to create a Room, I want that to happen in there but don't know really how I should realize that:



@room = Room.new(???)


??? should be the username of the User registration process. How do I integrate something like that in the Devise registration process?


Any help is appreciated thanks!



asked 1 min ago







Rails, Devise, Sign up = write name in other Database

Aucun commentaire:

Enregistrer un commentaire