class Outpost::List::Filter
Constants
- BOOLEAN_COLLECT
Attributes
attribute[RW]
collection[RW]
list[RW]
title[RW]
Public Class Methods
new(attribute, list, options={})
click to toggle source
# File lib/outpost/list/filter.rb, line 11 def initialize(attribute, list, options={}) @attribute = attribute.to_s @list = list @title = options[:title] || @attribute.titleize collection = options[:collection] @collection = begin case collection when NilClass # No collection given. Find it ourselves. if list.model.column_names.include?(@attribute) -> { list.model.order(@attribute).pluck("distinct #{@attribute}") } else # TODO Handle association filtering end when Proc collection when Symbol send "_#{collection}_collection" end end end
Private Instance Methods
_boolean_collection()
click to toggle source
# File lib/outpost/list/filter.rb, line 38 def _boolean_collection -> { BOOLEAN_COLLECT } end