I have an action (send_confcode) that will send a confirmation code via sms as soon as a new user signs up. I would like to know where this action should be placed. Is it under the User model generated by Devise?
def send_confcode
@confcode = (Time.now.to_i).to_s.slice(6,9)
# more code here for sending code via an sms api
end
Use an
after_createcallback method in your User model. Add this to your user model:After a user is created it will call the
send_confcodemethod.You can read more about Rails callbacks here: http://guides.rubyonrails.org/active_record_validations_callbacks.html#callbacks-overview