Reputation: 580
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.
Upvotes: 1
Views: 913
Reputation: 18090
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.
Upvotes: 3