#<WelcomeController:0x00000006ab2df8> 的未定义方法“布局”

jun*_*nky 1 ruby layout controller ruby-on-rails ruby-on-rails-3

我希望我的欢迎控制器使用不同的布局:

class WelcomeController < ApplicationController

  def index
    if signed_in?
      layout 'default'
    else
      layout 'welcome'
    end
    render 'welcome/index'
  end

end
Run Code Online (Sandbox Code Playgroud)

Ver*_*cus 5

class WelcomeController < ApplicationController

  def index
    if signed_in?
      render :layout => 'default'
    else
      render :layout => 'welcome'
    end
  end

end
Run Code Online (Sandbox Code Playgroud)