Sha256: e449f7480b42c037c10af11be8ace637938d46982a6136fdb830702be512cebe

Contents?: true

Size: 750 Bytes

Versions: 66

Compression:

Stored size: 750 Bytes

Contents

module Avo
  class DynamicRouter
    def self.routes
      Avo::Engine.routes.draw do
        scope "resources", as: "resources" do
          # Check if the user chose to manually register the resource files.
          # If so, eager_load the resources dir.
          if Avo.configuration.resources.nil?
            Avo::App.eager_load(:resources) unless Rails.application.config.eager_load
          end

          Avo::App.fetch_resources
            .select do |resource|
              resource != :BaseResource
            end
            .select do |resource|
              resource.is_a? Class
            end
            .map do |resource|
              resources resource.new.route_key
            end
        end
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
avo-2.53.0 lib/avo/dynamic_router.rb
avo-2.52.0 lib/avo/dynamic_router.rb
avo-2.49.0 lib/avo/dynamic_router.rb
avo-2.48.0 lib/avo/dynamic_router.rb
avo-2.47.0 lib/avo/dynamic_router.rb
avo-2.46.0 lib/avo/dynamic_router.rb
avo-2.45.0 lib/avo/dynamic_router.rb
avo-2.44.0 lib/avo/dynamic_router.rb
avo-2.43.0 lib/avo/dynamic_router.rb
avo-2.42.2 lib/avo/dynamic_router.rb
avo-2.42.1 lib/avo/dynamic_router.rb
avo-2.42.0 lib/avo/dynamic_router.rb
avo-2.41.0 lib/avo/dynamic_router.rb
avo-2.40.0 lib/avo/dynamic_router.rb
avo-2.39.0 lib/avo/dynamic_router.rb
avo-2.38.0 lib/avo/dynamic_router.rb
avo-2.37.2 lib/avo/dynamic_router.rb
avo-2.37.1 lib/avo/dynamic_router.rb
avo-2.37.0 lib/avo/dynamic_router.rb
avo-2.36.3 lib/avo/dynamic_router.rb