Sha256: d5d6ab8dab3c86225d96894193e397cc28dbb1480b6339adb0d8584b5bea1b09

Contents?: true

Size: 505 Bytes

Versions: 27

Compression:

Stored size: 505 Bytes

Contents

module Avo
  module DynamicRouter
    def self.routes(router)
      Rails.application.eager_load! unless Rails.env.production?

      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

27 entries across 27 versions & 1 rubygems

Version Path
avo-2.8.0 lib/avo/dynamic_router.rb
avo-2.7.1.pre.1 lib/avo/dynamic_router.rb
avo-2.7.0 lib/avo/dynamic_router.rb
avo-2.6.1.pre.2 lib/avo/dynamic_router.rb
avo-2.6.1.pre.1 lib/avo/dynamic_router.rb
avo-2.6.0 lib/avo/dynamic_router.rb
avo-2.5.2.pre.7 lib/avo/dynamic_router.rb
avo-2.5.2.pre.6 lib/avo/dynamic_router.rb
avo-2.5.2.pre.5 lib/avo/dynamic_router.rb
avo-2.5.2.pre.4 lib/avo/dynamic_router.rb
avo-2.5.2.pre.3 lib/avo/dynamic_router.rb
avo-2.5.2.pre.2 lib/avo/dynamic_router.rb
avo-2.5.2.pre.1 lib/avo/dynamic_router.rb
avo-2.5.1 lib/avo/dynamic_router.rb
avo-2.5.0 lib/avo/dynamic_router.rb
avo-2.4.1 lib/avo/dynamic_router.rb
avo-2.4.0 lib/avo/dynamic_router.rb
avo-2.3.1.pre.6 lib/avo/dynamic_router.rb
avo-2.3.1.pre.5 lib/avo/dynamic_router.rb
avo-2.3.1.pre.4 lib/avo/dynamic_router.rb