Sha256: 16b5f2975fef852c9d6cdccc6bc78ac8607230e338812fb7da205c45b4a98243
Contents?: true
Size: 614 Bytes
Versions: 7
Compression:
Stored size: 614 Bytes
Contents
require 'push_type/tag_list_query' module PushType class TagListField < ArrayField def template @opts[:template] || 'tag_list' end def html_options { multiple: true, placeholder: 'Tags...' }.merge(super).merge(class: 'tagsinput') end def to_json(val) super.reject(&:blank?) end def from_json(val) super.reject(&:blank?) end initialized_on_node do |object, field| object.define_singleton_method "all_#{ field.name }".to_sym do |*args| TagListQuery.new(field.name, object.name.underscore.to_sym).all *args end end end end
Version data entries
7 entries across 7 versions & 1 rubygems