【发布时间】:2014-03-10 15:02:03
【问题描述】:
我正在为我的应用构建一个自定义管理部分,我希望 :admin 命名空间有自己的布局。
到目前为止,我一直在 app/controllers/application_controller.rb 中玩这个:
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
layout :cond_layout
def cond_layout
if controller_path.split("/").first == "admin"
"panel"
else
"application"
end
end
end
一个朋友告诉我用的,但它闻起来很腥。除了 Semantic-UI 停止在 admin 命名空间中工作。我做错了什么?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 namespaces