title: Rails Set Layout Based on URL Params
body: <p>So I am trying to change the layout of a view based on url params.</p>
  
  <p>So far, I figured out I have to set the layout in the controller. In my controller under the show action I have:</p>
  
  <pre><code>if params['iframe'] == 'true'
    render :layout =&gt; 'vendored'
  end
  </code></pre>
  
  <p>The layout 'vendored' exists in views/layouts. I am getting the dreaded rendering multiple times. Here is the rest of the show action in my controller:</p>
  
  <pre><code> def show
      @event = Event.find(params[:id])
      @user = current_user
      @approved_employers = current_user.get_employers_approving_event(@event) if user_signed_in?
      respond_with(@event)
  </code></pre>
  
  <p>The problem is that I don't see another render. I don't see another one in the entire controller. Of course, there is a render somewhere because it is rendering my default application layout, is that causing the problem? I read in the rails docs that I can add </p>
  
  <pre><code>and return
  </code></pre>
  
  <p>to the end and that should fix the problem, but not sure where to put that since the two renders are not next to each other. I also don't see any other redirect_to's either. Where should I be looking for this other render? Is that the problem?</p>