dewski / kss-rails

A rails engine for @kneath's KSS documentation
MIT License
151 stars 39 forks source link

Layout issue related to ::ApplicationController inheritance #22

Open mikefowler opened 11 years ago

mikefowler commented 11 years ago

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.

dewski commented 11 years ago

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?

mikefowler commented 11 years ago

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.

nfedyashev commented 9 years ago

In my project I got it solved with this diff:

   layout :layout

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