Class: Symphonia::ModelFilters::IntegerFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/symphonia/model_filters/integer_filter.rb

Instance Attribute Summary

Attributes inherited from Base

#caption, #name, #operator, #options, #query, #type, #value

Instance Method Summary collapse

Methods inherited from Base

#active?, #initialize, #inspect

Constructor Details

This class inherits a constructor from Symphonia::ModelFilters::Base

Instance Method Details

#apply(scope) ⇒ Object



5
6
7
8
9
# File 'lib/symphonia/model_filters/integer_filter.rb', line 5

def apply(scope)
  super
  t = scope.arel_table
  scope.where(t[name].send(operator, value.to_f))
end

#form_field(_c) ⇒ Object



11
12
13
# File 'lib/symphonia/model_filters/integer_filter.rb', line 11

def form_field(_c)
  _c.number_field_tag(form_field_name, @query.active_filters[name], class: 'form-control')
end