0

I have a rails app where I want only Users with an activation code could get a confirmation email, otherwise they will just be registered and not get confirmation email.

Here is what I'm planning to do, would this be something that would work ?

class RegistrationsController < Devise::RegistrationsController

  def create
       if resource.activation_code == "ActivationCode"
         super
       else
         user = User.new(resource)
         user.skip_confirmation!
         user.save
       end
    end

end
0bserver07
  • 3,390
  • 1
  • 28
  • 56

1 Answers1

0

Yup! Solved it!

def create
   build_resource(sign_up_params)
   if resource.activation_code == "ActivationCode"
     super
   else
     user = User.new(sign_up_params)
     user.skip_confirmation!
     user.save
   end
end
0bserver07
  • 3,390
  • 1
  • 28
  • 56