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

Track changes on has_many association #48

Open
MatheusRich opened this issue Jul 24, 2020 · 1 comment
Open

Track changes on has_many association #48

MatheusRich opened this issue Jul 24, 2020 · 1 comment

Comments

@MatheusRich
Copy link

This is the current code for checking changes in models:

def changes_for_model
  changes = {}
  @model.class.reflect_on_all_associations(:belongs_to).each do |belongs_to_assoc|
    changes.merge!(association_change(belongs_to_assoc))
  end
  return changes.merge!(non_association_changes)
end

There's any problem in tracking has_many associations too?

@asibs
Copy link
Contributor

asibs commented Mar 3, 2021

Hi @MatheusRich

Drafting related objects is supported, see for example https://github.com/38degrees/draft_approve#create-multiple-related-drafts

There are also various examples in the integration test suite for creating / updating multiple linked entities, eg:

Could you clarify your use case? Is there some example code you can show which you would expect to work, but doesn't (or doesn't do what you'd expect it to)?

Thanks!

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

2 participants