未定义的方法`layout&#39; for#<welcomecontroller:0x00000006ab2df8> </welcomecontroller:0x00000006ab2df8>

时间:2012-04-13 15:27:05

标签: ruby-on-rails ruby ruby-on-rails-3 layout controller

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

class WelcomeController < ApplicationController

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

end

1 个答案:

答案 0 :(得分:4)

class WelcomeController < ApplicationController

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

end