I'm trying to sign in and redirect a user to home_path if certain criteria are met, otherwise they are unapproved and redirected to another page. When I sign in the user through the controller, they are redirected to users#show though (users/:id).
How can I sign them in, and get it to redirect to home_path which is 'profile/home' from the registrations controller?
registrations controller:
def after_inactive_sign_up_path_for(resource)
if resource.location === "New York, NY, United States"
if (really long query)
puts "accepted!"
resource.approved = true
resource.save!
sign_in(resource)
home_path
else
puts "Not accepted"
'/profile/waitlist'
end
else
puts "City is not New York!"
'/profile/waitlist'
end
end
application controller
def after_sign_in_path_for(resource)
home_path
end
Thank you in advance