You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there,
I'm facing issues in my code right now because of some lack of flexibility in some methods, for exemple, #create in RegistrationsController (i am implementing some rather complicated login logic with scopes all the way through some STI)
My idea would be to extract the resource's initialization code out to an overrideable method
(a bit like when you had moved out those methds to the ResourceFinder Concern which super super useful !)
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
@resource.provider = provider
# honor devise configuration for case_insensitive_keys
if resource_class.case_insensitive_keys.include?(:email)
@resource.email = sign_up_params[:email].try :downcase
else
@resource.email = sign_up_params[:email]
end
should become something like :
build_registration_resource
which would then set the resource:
def build_registration_resource
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
@resource.provider = provider
# honor devise configuration for case_insensitive_keys
if resource_class.case_insensitive_keys.include?(:email)
@resource.email = sign_up_params[:email].try :downcase
else
@resource.email = sign_up_params[:email]
end
end
What do you think about that, could that be something you'd be up for? or just a bad idea?
The text was updated successfully, but these errors were encountered:
Hello there,
I'm facing issues in my code right now because of some lack of flexibility in some methods, for exemple,
#create
inRegistrationsController
(i am implementing some rather complicated login logic with scopes all the way through some STI)My idea would be to extract the resource's initialization code out to an overrideable method
(a bit like when you had moved out those methds to the ResourceFinder Concern which super super useful !)
should become something like :
which would then set the resource:
What do you think about that, could that be something you'd be up for? or just a bad idea?
The text was updated successfully, but these errors were encountered: