8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 90538e9 commit 38c227aCopy full SHA for 38c227a
lib/active_admin/mongoid/association/relatable.rb
@@ -6,4 +6,9 @@ def macro
6
def embeds?
7
[:embeds_one, :embeds_many].include?(macro)
8
end
9
+
10
+ def foreign_key
11
+ return if embeds?
12
+ foreign_key.to_sym rescue nil
13
+ end
14
lib/active_admin/mongoid/filters/resource_extension.rb
@@ -6,7 +6,7 @@ def default_association_filters
without_embedded = resource_class.reflect_on_all_associations.reject { |e| e.embeds? }
poly, not_poly = without_embedded.partition{ |r| r.macro == :belongs_to && r.options[:polymorphic] }
- filters = poly.map(&:foreign_type) + not_poly.map(&:name)
+ filters = poly.map(&:foreign_key) + not_poly.map(&:name)
filters.map &:to_sym
else
[]
0 commit comments