Skip to content

Load Error when rails app uses an engine #18

Closed
bradseefeld opened this Issue Oct 25, 2012 · 6 comments

4 participants

@bradseefeld

I think this is isolated to when the rails application is using an engine, but it may be more broad than that. The error:

LoadError (Expected app/controllers/application_controller.rb to define ApplicationController):
  app/controllers/application_controller.rb:1:in `<top (required)>'
  app/controllers/audits_controller.rb:1:in `<top (required)>'

The controller:

class ApplicationController < MyEngine::ApplicationController
  ...
end

When I change it to extend from ActionController::Base things work just fine. I imagine this has to do with the load order for fozzie vs my engine?

When I dont include the fozzie gem, things work fine. I have tested on all published versions of fozzie as well as checking out master.

@marckysharky

If this issue is specific to Fozzie and Rails integration, the Fozzie Rails is the better place for this to live.

If you want to use the Fozzie Rails functionality in your Rails application, there is no need to change the Controller inheritance, you just need to add:

gem 'fozzie_rails'

to your Gemfile and bundle, the middleware functionality is automatically loaded via Railtie.

If I have misunderstood your issue, please reply with some more details on how you have setup your app.

@bradseefeld

Yes, I saw the fozzie_rails and I get the same error when I use that instead. I was trying to debug the issue a bit. The rails version just adds a railtie to automate the middleware setup. So I dont think any code in the fozzie_rails repo is causing this behavior. That is why I opened it here.

The actual problem is a little different. I am not attempting to change my inheritance when I use this gem. When I add the gem, no other code changes, I get the error above. Looking into the issue a bit more, I was able to isolate the problem to controllers that extended classes from my engine.

@bradseefeld

I've tracked this down to the facets gem. When I remove that from a checkout of fozzie, everything works great.

I thought it might be related to rubyworks/facets#55 which is not included in their latest version (2.9.3). So I checkout facets from master and build, but I end up with another bug: rubyworks/facets#71

Long story short, I dont think this bug is related to fozzie... Thanks anyway!

@kcm
kcm commented Feb 19, 2013

Any further progress or changes here? I'm running into a similar problem with loading via unicorn, though Rack/pow locally work fine:

https://gist.github.com/kcm/3accb14f31bc37887265

@kcm
kcm commented Feb 19, 2013

OK, the piecemeal (pre)loading trick worked for me, but is fragile in that I need to keep it updated if fozzie has new facets requirements.

@sciurus sciurus referenced this issue in lonelyplanet/fozzie_rails May 9, 2014
Merged

Strange problem with Rails and fozzie_rails #1

@robuye
Lonely Planet member
robuye commented May 16, 2016

It's fixed, new versions have been pushed to rubygems.

Thanks for the report and apologies for huge delay.

@robuye robuye closed this May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.