开发者

Different layout for just one certain page in Rails

I want to have a different layout for just one certain action in my Rails app. How do I do tha开发者_C百科t?


# controller that calls the page
def action
  render :layout => 'other'
end


class MyController < ApplicationController
  layout "special", :only => :action

  def action
    #action code
  end
end


 layout :resolve_layout

  .
  .
  .
     private   
      def resolve_layout
       case action_name
         when "new"
          "alternate"
         else 
          "application"
         end
      end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜