Sha256: edb08b4603c75b7865bf0c2a11b91e1430ad3bbace27293508a753cd9f62c8d9

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

require "tramway/collection"

module Tramway
  module Event
    module ApplicationHelper
      include ::FontAwesome::Rails::IconHelper
      #extend ::Tramway::Collection::Helper
      def collection_list_by(name:)
        require name # needed to load class name with collection
        unless ::Tramway::Collection.descendants.map(&:to_s).include?(name.camelize)
          raise "There no such collection named #{name.camelize}. Please create class with self method `list` and extended of `Tramway::Collection`" 
        end

        name.camelize.constantize.list
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tramway-event-1.2.4 app/helpers/tramway/event/application_helper.rb
tramway-event-1.2.3 app/helpers/tramway/event/application_helper.rb