File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1313require 'active_admin/mongoid/helpers/collection'
1414require 'active_admin/mongoid/criteria'
1515require 'active_admin/mongoid/order_clause'
16+ require 'active_admin/mongoid/association/relatable'
1617
1718require 'active_admin/mongoid/inputs/filters/check_boxes_input'
1819require 'active_admin/mongoid/inputs/filters/select_input'
Original file line number Diff line number Diff line change 1+ Mongoid ::Association ::Relatable . module_eval do
2+ def macro
3+ self . class . name . split ( '::' ) . last . underscore . to_sym
4+ end
5+
6+ def embeds?
7+ [ :embeds_one , :embeds_many ] . include? ( macro )
8+ end
9+ end
Original file line number Diff line number Diff line change 33module ActiveAdmin ::Filters ::ResourceExtension
44 def default_association_filters
55 if resource_class . respond_to? ( :reflect_on_all_associations )
6- without_embedded = resource_class . reflect_on_all_associations . reject { |e | [ :embeds_many , :embeds_one ] . include? e . macro }
6+ without_embedded = resource_class . reflect_on_all_associations . reject { |e | e . embeds? }
77 poly , not_poly = without_embedded . partition { |r | r . macro == :belongs_to && r . options [ :polymorphic ] }
88
99 filters = poly . map ( &:foreign_type ) + not_poly . map ( &:name )
You can’t perform that action at this time.
0 commit comments