I suspect there’s an easier version of this question that I could ask,
but I’m not sure where I’m going wrong. I have LoginEngine and
UserEngine setup and seemingly running fine. However, not all of my
controllers are being found when I run “rake sync_permissions”.
Specifically, it’s the controllers that are not in the base
controllers folder, but rather in a subfolder. I have my admin
controllers separated in their own “admin” directory directly under
the normal controllers directory.
I’ve stepped through the Permission.synchronize_with_controllers
method with the console to try to figure out what’s going on.
This line does pick up all of my controllers.
controller_files = Dir[RAILS_ROOT +
“/app/controllers/**/*_controller.rb”]
But then this line doesn’t include any of my admin controllers.
ApplicationController.all_controllers.collect do |controller|
If I understand this correctly, ApplicationController is an instance
of my application.rb file in the controllers directory. Yes? Is
there something that I need to do so that it’s aware of controllers in
the subdirectories?
/app/controllers/application.rb
require ‘login_engine’
class ApplicationController < ActionController::Base
include LoginEngine
include UserEngine
helper :user
model :user
before_filter :authorize_action
end
Example of one of my admin controllers.
class Admin::PlayersController < ApplicationController
layout “admin_layout”
#… methods here (I have several methods defined here, but figured
no one really cared to see them all …
end
– James