Sha256: 7c2abc0926072f69b73ea2748342435bfb1c333252bfaafb94501709d2993e2b
Contents?: true
Size: 1009 Bytes
Versions: 6
Compression:
Stored size: 1009 Bytes
Contents
require "active_support/core_ext/module/delegation" module Administrate module Field class Deferred def initialize(deferred_class, options = {}) @deferred_class = deferred_class @options = options end attr_reader :deferred_class, :options def new(*args) new_options = args.last.respond_to?(:merge) ? args.pop : {} deferred_class.new(*args, options.merge(new_options)) end def ==(other) other.respond_to?(:deferred_class) && deferred_class == other.deferred_class && options == other.options end def searchable? options.fetch(:searchable, deferred_class.searchable?) end def searchable_field options.fetch(:searchable_field) end def permitted_attribute(attr, _options = nil) options.fetch(:foreign_key, deferred_class.permitted_attribute(attr, options)) end delegate :html_class, to: :deferred_class end end end
Version data entries
6 entries across 6 versions & 2 rubygems