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.32.5 lib/avo/dynamic_router.rb
avo-2.32.4 lib/avo/dynamic_router.rb
avo-2.32.3 lib/avo/dynamic_router.rb
avo-2.32.2 lib/avo/dynamic_router.rb
avo-2.32.1 lib/avo/dynamic_router.rb
avo-2.32.0 lib/avo/dynamic_router.rb
avo-2.31.0 lib/avo/dynamic_router.rb
avo-2.30.2 lib/avo/dynamic_router.rb
avo-2.30.1 lib/avo/dynamic_router.rb
avo-2.30.1.pre4.pr1683 lib/avo/dynamic_router.rb
avo-2.30.1.pre3.pr1683 lib/avo/dynamic_router.rb
avo-2.30.1.pre2.pr1683 lib/avo/dynamic_router.rb
avo-2.30.1.pre1.pr1683 lib/avo/dynamic_router.rb
avo-2.30.0 lib/avo/dynamic_router.rb
avo-2.29.1 lib/avo/dynamic_router.rb
avo-2.29.1.pre.pr1652 lib/avo/dynamic_router.rb
avo-2.29.0 lib/avo/dynamic_router.rb
avo-2.28.3.pre.pr1646 lib/avo/dynamic_router.rb
avo-2.28.2.pre.pr1642 lib/avo/dynamic_router.rb
avo-2.28.1.pre.pr1642 lib/avo/dynamic_router.rb