Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support polymorphic relationships that use the same AR class #3

Open
waymondo opened this issue Apr 7, 2023 · 0 comments
Open

support polymorphic relationships that use the same AR class #3

waymondo opened this issue Apr 7, 2023 · 0 comments

Comments

@waymondo
Copy link
Owner

waymondo commented Apr 7, 2023

currently if multiple polymorphic belong_to relationships reference the same class, the dynamic setter method will just use the first match

def assign_exclusive_arc(arc, polymorphic)
attributes = exclusive_arcs.fetch(arc).reflections.to_h do |name, reflection|
[name, polymorphic.is_a?(reflection.klass) ? polymorphic : nil]
end
assign_attributes attributes
end

@waymondo waymondo changed the title add support for multiple relationships for the same AR class support polymorphic relationships that use the same AR class Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant