1
votes

I have a rails engine that expose the following controller:

class ActsAsAssets::AssetsController < ApplicationController
..........

The main application uses devise into the ApplicationController. From the main application I use to extend the Engine Controller normally like this:

class MainApplicationController < ActsAsAssets::AssetsController
.......

What I was aspecting is that MainApplicationController was extending the main application ApplicationController via the engine. Note that the engine does not have any ApplicationController so I was expecting ActsAsAssets::AssetsController < ApplicationController to actually extend the ApplicationController of the rails app that uses the engine.

Looks like I am wrong.

Any suggestion? Basically what I want to achieve is that a controller from my main app extends a rails engine controller that extends the main ApplicationController cause does not have one inside the engine.

Hoper is clear.

1
Out of curiousity, why don't you have one in the engine? You shouldn't have any conflicts so long as you namespace everything correctly. However, if you need to do it this way, I am wondering what is going wrong when you launch the rails app? - agmcleod

1 Answers

3
votes

Change the declaration to look like this:

class ActsAsAssets::AssetsController < ::ApplicationController

That instructs the controller to extend the non-namespaced ApplicationController from the main application.