lib/avo/dynamic_router.rb in avo-2.18.0 vs lib/avo/dynamic_router.rb in avo-2.18.1.pre.1.eagerloaddirs

- old
+ new

@@ -1,21 +1,22 @@ module Avo - module DynamicRouter - def self.routes(router) - Rails.application.eager_load! unless Rails.env.production? + class DynamicRouter + def self.routes + Avo::Engine.routes.draw do + scope "resources", as: "resources" do + Avo::App.eager_load(:resources) unless Rails.application.config.eager_load - BaseResource.descendants - .select do |resource| - resource != :BaseResource + BaseResource.descendants + .select do |resource| + resource != :BaseResource + end + .select do |resource| + resource.is_a? Class + end + .map do |resource| + resources resource.new.route_key + end end - .select do |resource| - resource.is_a? Class - end - # .select do |resource| - # resource.model_class.present? - # end - .map do |resource| - router.resources resource.new.route_key - end + end end end end