title: Rails wicked wizard with javascript
body: <p>I want to create a wizard in js.</p>
  
  <pre><code>steps   :first_step,
          :second_step
  </code></pre>
  
  <p>In my 'controller_step'</p>
  
  <pre><code>def show
          case step
              when :first_step
                  @r  = R.new
              when :second_step
  
              end
          render_wizard
  end
  
  def update
          case step
              when :first_step
                  @r = R.new(r_params)
              when :second_step
  
              end
  
          render_wizard @r
  end
  </code></pre>
  
  <p>I have problems after the update of the first step. I'm receive the following error message: </p>
  
  <blockquote>
    <p>"Missing template controller_step/second_step, application/second_step
    with {:locale=>[:en], :formats=>[:html], :variants=>[],
    :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. ".</p>
  </blockquote>
  
  <p>How can I force loading of js templete? I would load "second_step.js.erb".</p>
  
  <p>I tried to change the update method:</p>
  
  <pre><code>respond_to do |format|
    format.js { render :js =&gt; ( render_wizard @r ) }  
  end
  </code></pre>
  
  <p>Of course I get the following error: </p>
  
  <blockquote>
    <p>"AbstractController::DoubleRenderError in ...Controller#update Render
    and/or redirect were called multiple times in this action. Please note
    that you may only call render OR redirect, and at most once per
    action. Also note that neither redirect nor render terminate execution
    of the action, so if you want to exit an action after redirecting, you
    need to do something like "redirect_to(...) and return"."</p>
  </blockquote>
  
  <p>I also tried to change the code (in update):</p>
  
  <pre><code>respond_to do |format|
     format.js { render :js =&gt; ( render_wizard @room_types and return ) } 
  end
  </code></pre>
  
  <p>I'm get the same error ( ... application/second_step with {:locale=>[:en], :formats=>[:html] .... )</p>
  
  <p>P.S.</p>
  
  <p>In view of the first step:</p>
  
  <pre><code>&lt;%= form_for(@r, url: wizard_path, method: :put, remote: true) do |f| %&gt;
     ....
     &lt;%= f.submit "Submit", class: "btn btn-default" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>How do I fix ? thanks in advance</p>