module ActiveAdmin::Filters::FormtasticAddons
Public Instance Methods
column()
click to toggle source
An override to the built-in method, that respects Ransack. Since this is corrected, `column?` will also work.
# File lib/active_admin/filters/formtastic_addons.rb, line 30 def column column_for method end
column_for(method)
click to toggle source
Returns the column for an attribute on the object being searched if it exists.
# File lib/active_admin/filters/formtastic_addons.rb, line 24 def column_for(method) klass.columns_hash[method.to_s] if klass.respond_to? :columns_hash end
humanized_method_name()
click to toggle source
Returns the default label for a given attribute. Uses ActiveModel I18n if available.
# File lib/active_admin/filters/formtastic_addons.rb, line 10 def humanized_method_name if klass.respond_to?(:human_attribute_name) klass.human_attribute_name(method) else method.to_s.send(builder.label_str_method) end end
klass()
click to toggle source
The resource class, unwrapped from Ransack
# File lib/active_admin/filters/formtastic_addons.rb, line 39 def klass @object.object.klass end
polymorphic_foreign_type?(method)
click to toggle source
# File lib/active_admin/filters/formtastic_addons.rb, line 43 def polymorphic_foreign_type?(method) klass.reflections.values.select{ |r| r.macro == :belongs_to && r.options[:polymorphic] } .map(&:foreign_type).include? method.to_s end
reflection_for(method)
click to toggle source
Returns the association reflection for the method if it exists
# File lib/active_admin/filters/formtastic_addons.rb, line 19 def reflection_for(method) klass.reflect_on_association(method) if klass.respond_to? :reflect_on_association end