title: Ruby on Rails: redirect_to not working after create and save
body: <p>I want to <code>redirect_to slider_path</code> after a user submits their email. Currently, only the success message is displayed without a redirect. Here's the code:</p>
  
  <pre><code>class Splash::SubscribersController &lt; ApplicationController
  
  def create
  
    @subscriber = Subscriber.new(params[:subscriber])
  
    if @subscriber.save
      success = true
      message = "Success! We'll let you know when we launch."
    else
      success = false
      message = "Fail."
    end
  
    respond_to do |format|
      format.html { 
        if success
          flash[:success] = message
          redirect_to slider_path
        else 
          flash[:error] = message
        end
        redirect_to root_path 
      }
      format.json { render :json =&gt; { :success =&gt; success, :message =&gt; message }.to_json }
    end  
   end
  end
  </code></pre>