Skip to content

Commit ed41c8c

Browse files
committed
feat: make polymorphic type lookup configurable
1 parent 7946f83 commit ed41c8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/jsonapi/utils/polymorphic_types_lookup.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ module Utils
55
module PolymorphicTypesLookup
66
extend self
77

8+
singleton_class.attr_accessor :build_polymorphic_types_lookup_strategy
9+
self.build_polymorphic_types_lookup_strategy =
10+
:build_polymorphic_types_lookup_from_object_space
11+
812
def polymorphic_types(name, rebuild: false)
913
polymorphic_types_lookup(rebuild: rebuild).fetch(name.to_sym, &handle_polymorphic_type_name_found)
1014
end
@@ -29,10 +33,6 @@ def build_polymorphic_types_lookup
2933
public_send(build_polymorphic_types_lookup_strategy)
3034
end
3135

32-
def build_polymorphic_types_lookup_strategy
33-
:build_polymorphic_types_lookup_from_object_space
34-
end
35-
3636
def build_polymorphic_types_lookup_from_descendants
3737
{}.tap do |lookup|
3838
ActiveRecord::Base

0 commit comments

Comments
 (0)