Sha256: b76f95534149abb037c04c4a87f3e03d743c982659522c61e5a51ea08eb88643

Contents?: true

Size: 416 Bytes

Versions: 6

Compression:

Stored size: 416 Bytes

Contents

require_relative "base"

module Administrate
  module Field
    class Select < Field::Base
      def self.searchable?
        true
      end

      def selectable_options
        collection
      end

      private

      def collection
        maybe_proc = options.fetch(:collection, [])
        return maybe_proc.call if maybe_proc.respond_to? :call

        @collection ||= maybe_proc
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
viniBaxterDesk-22.0.0 lib/administrate/field/select.rb
viniBaxterDesk-0.21.0 lib/administrate/field/select.rb
viniBaxterDesk-0.20.0 lib/administrate/field/select.rb
viniBaxterDesk-0.14.0 lib/administrate/field/select.rb
viniBaxterDesk-0.13.2 lib/administrate/field/select.rb
viniBaxterDesk-0.13.1 lib/administrate/field/select.rb