Sha256: 8fb13bef5e9e6d95aef19321d6cc795048259c82f5791141e1da52d2361feb5d

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

require "administrate/field/has_many"
require "rails"

module Administrate
  module Field
    class HasManySearch < Administrate::Field::HasMany
      class Engine < ::Rails::Engine
        initializer "administrate-field-has_many_search.add_assets" do |app|
          app.config.assets.precompile << "has_many_search.js" if app.config.respond_to? :assets
          Administrate::Engine.add_javascript "has_many_search.js" if defined?(Administrate::Engine)
        end
      end

      def associated_resource_options
        if data.blank?
          []
        else
          data.map do |d|
            [display_candidate_resource(d), d.id]
          end
        end
      end

      def associated_class
        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
administrate-field-has_many_search-0.2.1 lib/administrate/field/has_many_search.rb
administrate-field-has_many_search-0.2.0 lib/administrate/field/has_many_search.rb
administrate-field-has_many_search-0.1.0 lib/administrate/field/has_many_search.rb