Sha256: 48d122f58b04bae84a31a5bfe1869ed9168372a13b368df3bb1bfdee17aa1e0c

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

require 'administrate/field/belongs_to'
require 'rails'

module Administrate
  module Field
    class BelongsToSearch < Administrate::Field::BelongsTo
      class Engine < ::Rails::Engine
        config.assets.precompile << 'belongs_to_search.js' if config.respond_to? :assets
        Administrate::Engine.add_javascript 'belongs_to_search.js' if defined?(Administrate::Engine)
      end

      def associated_resource_options
        if data.nil?
          []
        else
          [[display_candidate_resource(data), data.id]]
        end
      end

      def associated_class
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-belongs_to_search-0.1.2 lib/administrate/field/belongs_to_search.rb