Skip to content

Commit 884b5b0

Browse files
Merge pull request #127 from 3mundi/remove_embedded_filters
Avoid to create filters for embedded fields
2 parents 018812e + d8a35d6 commit 884b5b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/active_admin/mongoid/filters/resource_extension.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
module ActiveAdmin::Filters::ResourceExtension
44
def default_association_filters
55
if resource_class.respond_to?(:reflect_on_all_associations)
6-
poly, not_poly = resource_class.reflect_on_all_associations.partition{ |r| r.macro == :belongs_to && r.options[:polymorphic] }
6+
without_embedded = resource_class.reflect_on_all_associations.reject { |e| [:embeds_many, :embeds_one].include? e.macro }
7+
poly, not_poly = without_embedded.partition{ |r| r.macro == :belongs_to && r.options[:polymorphic] }
78

89
filters = poly.map(&:foreign_type) + not_poly.map(&:name)
910
filters.map &:to_sym

0 commit comments

Comments
 (0)