Hier habe ich einen Controller mit 4 Aktionen und ich möchte Anwendungslayout (das Standardlayout) nur auf neue Aktion anwenden, oder mit anderen Worten, ich möchte nur Index Aktion aus dem Layout, also schreibe ich dies aber es funktioniert nicht, die Indexvorlage wird mit dem Layout gerendert.Rendering Layout für bestimmte Aktionen
class SessionsController < ApplicationController
layout 'application', :except => :index
def index
end
def new
end
def create
end
end
def destroy
end
end
auch versuchte ich
layout 'application', :only => :new
aber es auch nicht funktioniert, gleiches Problem, das die Index-Vorlage wird mit Layout-Rendering. irgendwelche Vorschläge, was ist das Problem hier?
Nun, es funktioniert !! aber hast du eine ahnung warum Layout 'application',: except =>: index funktioniert nicht ?? BTW so Layout 'falsch',: außer =>: neu funktioniert auch – Azzurrio
ich denke, es ist, weil ich in meinem Fall Layout auf Null in allen Fällen statt neuer Aktion zu beheben. Bei der Verwendung von: except oder: only handelt es sich jedoch um das geerbte Layout, das in anderen Fällen verwendet wird. – shingara