Impact of inheriting controllers on models

I have some protected methods and authentication/acl filters I want to
inherit down through my controllers.

So I have controllers which inherit like this:

Application_controller

– AdminArea Controller

----dashboard controller
----user controller
----content controller
----
------page controller
------placement controller

– PublicArea Controller

At the deepest level the class definition looks like:
class Admin::Content::PagesController < Admin::ContentController

Now, for some reason this has just started to cause problems when trying
to use one of the search plugins available (specifically I have tried
ActiveSearch and Acts_as_ferret). For some reason when trying to trigger
a CRUD action on a model which has acts_as_ferret or indexes_columns
specified on it, I get a name error: uninitialized constant Page

One thing which stands out is the file that was supposed to be loaded:
This error occured while loading the following files:
admin/content/page.rb

All my model files are stored in /app/models with no sub-dirs, so why is
Rails looking for the model in the same path as the controller? (whether
it is searching /app/models or /app/controllers is not apparent).

If I try a CRUD operation from the console it works fine, and the
filters that acts_as_ferret trigger to update the index fire correctly.

So, is this issue due to the fact that I have this much inheritance in
my application, or because I have controllers named similarly to my
models (page.rb pages_controller.rb) or something I have totally
missed…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs