0

user.rb

has_one :company

My requirement is that when user sign up page is redirect to new company form. How can I get sign up user id there?

Is it possible?

2 Answers2

0

After signup devise gem login signup user if email not conformable so you can use current_user.id if for any reason you are not logged in after signup then login user and use current_user.id there

Put this code in application_controller.rb

  def after_sign_up_path_for(resource)
   sign_in resource
   #your path #company path in your case

  end
Thorin
  • 2,004
  • 1
  • 19
  • 30
0

Devise provides an helper method "current_user", which store the information of sign_up user

you can use current_user.id

RSakhi
  • 1
  • 2