ruby on rails - Rendering application.html.erb-like layout for a new namespace -
i'm building custom admin section app, , i'd :admin
namespace have own layout.
so far i've been playing in app/controllers/application_controller.rb:
class applicationcontroller < actioncontroller::base # prevent csrf attacks raising exception. # apis, may want 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
which friend told me use, smells fishy. besides semantic-ui stopped working in admin namespace. doing wrong?
if have , have admin::maincontroller.rb in admin namespace? don't hesitate override layout there. imho, cleaner..
Comments
Post a Comment