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 870bd62 commit fe08cc5Copy full SHA for fe08cc5
lib/anchor/resource.rb
@@ -161,7 +161,8 @@ def anchor_relationships_properties(included_fields:)
161
# @return [Anchor::Types::Reference, Anchor::Types::Array<Anchor::Types::Reference>, Anchor::Types::Maybe<Anchor::Types::Reference>]
162
def relationship_type_for(rel, resource_klass, name)
163
ref = Anchor::Types::Reference.new(resource_klass.anchor_schema_name)
164
- reflection = _model_class.try(:reflections).try(:[], name.to_s)
+ model_relationship_name = (rel.options[:relation_name] || name).to_s
165
+ reflection = _model_class.try(:reflections).try(:[], model_relationship_name)
166
wrapper = if reflection
167
Anchor::Types::Inference::ActiveRecord.wrapper_from_reflection(reflection)
168
else
0 commit comments