Sha256: 78bf1e9c44749fcd6ac77c420c6395be789332f03f108fbd9a582c9e9f17df81
Contents?: true
Size: 771 Bytes
Versions: 1
Compression:
Stored size: 771 Bytes
Contents
require 'active_admin/filters/humanized' module ActiveAdmin module Filters class Active attr_accessor :filters, :scope def initialize(resource_class, params) @resource_class = resource_class @params = normalize_params(params) @scope = humanize_scope @filters = build_filters end private def normalize_params(params) if params.is_a?(HashWithIndifferentAccess) params else params.to_unsafe_h end end def build_filters filters = @params[:q] || [] filters.map{ |param| Humanized.new(param) } end def humanize_scope scope = @params['scope'] scope ? scope.humanize : "All" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-1.0.0.pre5 | lib/active_admin/filters/active.rb |