Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 两个“;“全球”/应用程序布局_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails 两个“;“全球”/应用程序布局

Ruby on rails 两个“;“全球”/应用程序布局,ruby-on-rails,ruby,Ruby On Rails,Ruby,我是Rails新手,我想知道是否有可能有两种不同的应用程序布局?我希望我的网站的公共界面看起来不同于管理员看到的。因此,所有公共操作将在一个应用程序布局中呈现,而所有管理操作将在另一个应用程序布局中呈现 您可以决定在应用程序\u控制器中的前过滤器中使用哪个布局 class ApplicationController < ActionController::Base # other implementation layout :determine_layout def de

我是Rails新手,我想知道是否有可能有两种不同的应用程序布局?我希望我的网站的公共界面看起来不同于管理员看到的。因此,所有公共操作将在一个应用程序布局中呈现,而所有管理操作将在另一个应用程序布局中呈现

您可以决定在应用程序\u控制器中的
前过滤器
中使用哪个布局

class ApplicationController < ActionController::Base

  # other implementation

  layout :determine_layout

  def determine_layout
    current_user.admin? ? "admin" : "application"
  end

end
class ApplicationController
您可以确定在应用程序\u控制器中的
过滤器之前使用哪个布局

class ApplicationController < ActionController::Base

  # other implementation

  layout :determine_layout

  def determine_layout
    current_user.admin? ? "admin" : "application"
  end

end
class ApplicationController
class ApplicationController
class ApplicationController