2016-06-17 43 views

回答

0

你的具體情況適用:

要有設計使用一個單獨的佈局到應用程序的其餘部分, 你可以做這樣的事情:

class ApplicationController < ActionController::Base 
    layout :layout_by_resource 

    protected 

    def layout_by_resource 
    if devise_controller? 
     "layout_name_for_devise" 
    else 
     "application" 
    end 
    end 
end 

SOURCEhttps://github.com/plataformatec/devise/wiki/How-To:-Create-custom-layouts

+0

謝謝,我認爲它確實呈現在正確的佈局現在,但它現在沒有找到那個佈局中的模板。 '缺少部分用戶/會話/ _stylesheet,devise/sessions/_stylesheet,devise/_stylesheet,application/_stylesheet with {:locale => [:en],:formats => [:html],:variants => [] ,:handlers => [:erb,:builder,:raw,:ruby,:coffee,:jbuilder]}' – twist900

0

Solut離子1:

超越控制設計SessionsController與您的自定義會話控制器,並設置layout: :adminstrator

解決方案 - 2

ApplicationController

layout: custom_layout 

def custom_layout 
    params[:controller] == "sessions" ? "adminstrator" : "application" 
end 

希望它能幫助!

相關問題