I'm trying to create a Devise user manually. The hitch is that validations only seem to pass when I call User.create
.
When I call User.new
, the resulting user instance is invalid. Unfortunately, I can't determine why.
The resulting error message is simply "Validation failed: ".
Any idea what's going on?
I would prefer not to use User.create
because I want to call #skip_confirmation!
prior to save, so that there's no email that goes out.
Any ideas how to debug this? I've tried walking through the stack trace, but no luck.
if user = User.create(params[:user])
user.skip_confirmation!
user.save!
flash[:success] = "New user #{user.email} created."
redirect_to user_root_path
else
flash[:alert] = user.errors
redirect_to user_root_path
end