Sha256: 22fac8d884d569f12c4a4cf87cdcb49dfee9d1bb4f869c67a5dde408766e1c84

Contents?: true

Size: 388 Bytes

Versions: 23

Compression:

Stored size: 388 Bytes

Contents

module Avo
  module DynamicRouter
    def self.routes(router)
      Rails.application.eager_load!

      BaseResource.descendants
        .select do |resource|
          resource != :BaseResource
        end
        .select do |resource|
          resource.is_a? Class
        end
        .map do |resource|
          router.resources resource.new.model_key
        end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
avo-1.25.2 lib/avo/dynamic_router.rb
avo-1.25.1 lib/avo/dynamic_router.rb
avo-1.25.0 lib/avo/dynamic_router.rb
avo-1.24.2 lib/avo/dynamic_router.rb
avo-1.24.1 lib/avo/dynamic_router.rb
avo-1.24.0 lib/avo/dynamic_router.rb
avo-1.23.0 lib/avo/dynamic_router.rb
avo-1.22.4 lib/avo/dynamic_router.rb
avo-1.22.3 lib/avo/dynamic_router.rb
avo-1.22.2 lib/avo/dynamic_router.rb
avo-1.22.1 lib/avo/dynamic_router.rb
avo-1.22.1.pre.2 lib/avo/dynamic_router.rb
avo-1.22.1.pre.1 lib/avo/dynamic_router.rb
avo-1.22.0 lib/avo/dynamic_router.rb
avo-1.22.0.pre.1 lib/avo/dynamic_router.rb
avo-1.21.1.pre.1 lib/avo/dynamic_router.rb
avo-1.21.0 lib/avo/dynamic_router.rb
avo-1.20.2.pre.2 lib/avo/dynamic_router.rb
avo-1.20.2.pre.1 lib/avo/dynamic_router.rb
avo-1.21.0.pre.1 lib/avo/dynamic_router.rb