views:

19

answers:

1

I have an action called new:

  def new
    @bookmark = Bookmark.new

    respond_to do |format|
      format.html # new.html.erb
      format.mobile
      format.xml  { render :xml => @bookmark }
    end
  end

Now, when the param[:widget] == "true", I want to use a lay-out other than application.html.haml, and I want to show another view than new.html.haml called new_widget.html.haml.

How can I do this? Thanks.

+1  A: 

Something like this?

def new
  @bookmark = Bookmark.new

  if params[:widget] == "true"
    render 'new_widget.html.haml', :layout => 'path/to/other/layout'
    return
  end

  respond_to do |format|
    format.html # new.html.erb
    format.mobile
    format.xml  { render :xml => @bookmark }
  end
end
Dave Sims