Sha256: 29e8059980268133adb2259396f10b11b7119126f253987eb6cfa6b9930d905c
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
require 'ar_finder_form/attr' module ArFinderForm module Attr class Simple < Base attr_reader :operator def initialize(column, name, options) super(column, name, options) @operator = options.delete(:operator).to_s.downcase.to_sym end def setup client_class_eval("attr_accessor :#{name}") end def build(context) return unless match?(context) case operator when :in then context.add_condition("#{column_name(context)} IN (?)", form_value_array(context)) else context.add_condition( "#{column_name(context)} #{operator} ?", form_value(context)) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ar_finder_form-0.1.0 | lib/ar_finder_form/attr/simple.rb |