Sha256: e59cd191a3a1d6e35727cc2eb6d210aa8ca77c2eb0ff9e86216a18560f5fcec3

Contents?: true

Size: 476 Bytes

Versions: 4

Compression:

Stored size: 476 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
        # .select do |resource|
        #   resource.model_class.present?
        # end
        .map do |resource|
          router.resources resource.new.model_key
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
avo-2.1.2.pre1 lib/avo/dynamic_router.rb
avo-2.1.1 lib/avo/dynamic_router.rb
avo-2.1.0 lib/avo/dynamic_router.rb
avo-2.0.0 lib/avo/dynamic_router.rb