ruby - Redirect-related double render error in rails -


in controller redirecting user if signed out. pulling list of professionals.. , need redirect there too, if none exist. there way solve dilemma?

  def purchase     @style = style.find(params[:id])     if user_signed_in? && current_user.consumer        @professionals = professional.where(...)       if @professionals.empty?         redirect_to style_path(@style)       else         ...       end       ...     else       flash[:error] = "please sign in consumer access page"       redirect_to style_path(@style)     end   end 

try adding and return action returns , not continue. please try following:

redirect_to style_path(@style) , return 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -