cbeer / devise-guests

fake 'em until you make 'em
MIT License
130 stars 31 forks source link

transfer_guest_to_user is not always run on signin #44

Closed DavidGeismarLtd closed 1 year ago

DavidGeismarLtd commented 2 years ago

I noticed that transfer_guest_to_user is not always executed on signin. Reading through the code, I noticed that the logging_in callback is triggered by the helper method current_or_guest_user. So if you don't call this method sometimes during sign_in, transfer_guest_to_user wont be executed I guess ?

DavidGeismarLtd commented 2 years ago

To make sure transfer_guest_to_user was called on sign_up or sign_in. I had to add : after_action :current_or_guest_user, only: :create to both Devise::SessionsController and Devise::RegistrationsController

pacso commented 2 years ago

Providing you call current_or_guest_user some time after sign_in, then that method will be executed, and the transfer will take place.

Can you explain your use case that doesn't call current_or_guest_user after signing in?