kss-rails icon indicating copy to clipboard operation
kss-rails copied to clipboard

Layout issue related to ::ApplicationController inheritance

Open mikefowler opened this issue 12 years ago • 3 comments

I don't think this qualifies as an issue, but leaving it here in case you want to mention it somewhere @dewski.

Our team was having an issue where the kss layout file would occasionally fail to load, and we would only see a rendered view with no layout. Inspection of our logs found that because Kss::ApplicationController inherits from ::ApplicationController, there was some code running in our application's before_filter methods that was causing the layout to fail to load. We've solved this by having Kss::ApplicationController inherit from ActionController::Base rather than ::ApplicationController.

mikefowler avatar Mar 08 '13 00:03 mikefowler

I've seen a few people get bit by this and it's unfortunate. I liked that it inherited from ApplicationController that way any helpers or authentication filters were preserved. This sounds like a bug in Rails itself, do you remember which Rails version you were on by chance?

dewski avatar Oct 14 '13 19:10 dewski

I don't, unfortunately. I think it's very likely that our app is just fairly (potentially over-)complicated, not necessarily that this is a bug in Rails.

mikefowler avatar Oct 14 '13 21:10 mikefowler

In my project I got it solved with this diff:

   layout :layout

   def layout
+    if request.url.include?('/kss')
+      return 'kss/application'
+    end

nfedyashev avatar Feb 17 '15 17:02 nfedyashev