app/controllers/boilerman/controllers_controller.rb in boilerman-0.0.3 vs app/controllers/boilerman/controllers_controller.rb in boilerman-0.0.4

- old
+ new

@@ -1,13 +1,15 @@ require_dependency "boilerman/application_controller" module Boilerman class ControllersController < ApplicationController + before_filter :eager_load + def index - @action_with_filters = [:require_admin, :require_staff] - @action_without_filters = [:verify_authenticity_token] - @controller_filters = ["ApplicationController"] + @action_with_filters = [] + @action_without_filters = [] + @controller_filters = [] @controllers = filtered_controllers @controllers_and_callbacks = @controllers.map do |controller| callbacks = controller._process_action_callbacks [controller, callbacks.select{|callback| callback.kind == :before}.map(&:filter)] @@ -15,9 +17,25 @@ gon.controllers = @controllers.map{|x| x.to_s} end private + def eager_load + # FIXME This is required when developing boilerman and cache_classes is + # set to false. Need to think of a proper workaround for this. Possibly + # checking for a BOILERMAN_DEV enviornment variable and maybe changing + # this line to: + # + # Rails.application.eager_load! if ENV["BOILERMAN_DEV"] + # + # But then you have to specifify that everytime you run the app server + # for dev and if you forget it, debugging this is going not be fun. + # + # Alternatively, just eager_load on every request. It'll take a bit + # longer but we can be sure the classes will be there and most of the + # Boilerman usge is client side anyways. + Rails.application.eager_load! + end def filtered_controllers # Process only controllers with callbacks and do not include # Boilerman's own controllers controllers = ActionController::Metal.descendants.reject do |controller|