rails 3 custom mime type - default view format

前端 未结 2 1712
一生所求
一生所求 2021-01-03 15:20

I need to render some views without layout. To skip line :render :layout=>false and if else logic from controller actions, i have custom mime type like phtml (plain html).<

2条回答
  •  盖世英雄少女心
    2021-01-03 15:40

    You can use the layout method in your controller directly:

    class ProductsController < ApplicationController
      layout "product", :except => [:index, :rss]
    end
    

    Or to use no layout at all:

    class ProductsController < ApplicationController
      layout nil
    end
    

    Check out the guide for more info.

提交回复
热议问题