module Godmin::Resources::ResourceService::Filters

Public Instance Methods

apply_filters(filter_params, resources) click to toggle source
# File lib/godmin/resources/resource_service/filters.rb, line 9
def apply_filters(filter_params, resources)
  if filter_params.present?
    filter_params.each do |name, value|
      if apply_filter?(name, value)
        resources = send("filter_#{name}", resources, value)
      end
    end
  end
  resources
end

Private Instance Methods

apply_filter?(name, value) click to toggle source
# File lib/godmin/resources/resource_service/filters.rb, line 22
def apply_filter?(name, value)
  return false if value == [""]
  filter_map.key?(name.to_sym) && value.present?
end