I assume that redirect_to signup_path returns either nil or false , so your and return not executed.
You can fix this in many ways, the easiest way to replace
redirect_to signup_path and return
by
redirect_to signup_path return
However, I suggest you make big changes. Try to change it.
if @profile.nil? || current_user.nil? || @profile.user.nil? sign_out redirect_to signup_path and return end if @profile.new_record? render 'new' and return else redirect_to more_questions_path and return end
By
if @profile.nil? || current_user.nil? || @profile.user.nil? sign_out redirect_to signup_path elsif @profile.new_record? render 'new' else redirect_to more_questions_path end
Thus, it is clear that only one path is possible without relying on a refund.
fotanus
source share