Sha256: af1a872329f08bd30efb197c3e61973c801ed06772b4eacdab0930943bab7f82
Contents?: true
Size: 663 Bytes
Versions: 20
Compression:
Stored size: 663 Bytes
Contents
require "active_support/concern" module LookupBy module Hooks module Formtastic extend ActiveSupport::Concern included do alias_method_chain :input, :lookup end def input_with_lookup(method, options = {}) klass = object.class if klass.respond_to?(:lookups) && klass.lookups.include?(method.to_sym) target = method.to_s.classify.constantize options[:collection] ||= target.pluck(target.lookup.field) if target.lookup.cache_all? end input_without_lookup(method, options) end end end end ::Formtastic::FormBuilder.send :include, LookupBy::Hooks::Formtastic
Version data entries
20 entries across 20 versions & 1 rubygems