Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. class Users::RegistrationsController < Devise::RegistrationsController
  2. def new
  3. build_resource({})
  4. resource.build_extra_phone_numbers
  5. render_with_scope :new
  6. end
  7.  
  8. def create
  9. # Copied and pasted from devise/app/controllers/devise/registrations_controller.rb
  10. build_resource
  11.  
  12. if resource.save
  13. if resource.active?
  14. sign_in resource
  15. redirect_to payment_url(resource)
  16. else
  17. set_flash_message :notice, :inactive_signed_up, :reason => resource.inactive_message.to_s
  18. redirect_to after_inactive_sign_up_path_for(resource)
  19. end
  20. else
  21. resource.build_extra_phone_numbers
  22. clean_up_passwords(resource)
  23. render_with_scope :new
  24. end
  25. end
  26.  
  27. def payment_url(user)
  28. receipt = user.payment_receipts.create
  29. receipt.payment_url(payment_receipt_url(receipt))
  30. end
  31. end
Add Comment
Please, Sign In to add comment