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

New model for root viewmodels #121

Merged
merged 1 commit into from
Jul 8, 2019
Merged

New model for root viewmodels #121

merged 1 commit into from
Jul 8, 2019

Conversation

chrisandreae
Copy link
Member

@chrisandreae chrisandreae commented May 15, 2019

Fixes #100

  • remove prune/include support
  • replace per-association shared with marking viewmodels as root or not
  • Add external associations, which can only be viewed/manipulated via AssociationManipulation. External associations may only be to root viewmodels.
  • Add support for owned has_one associations to root viewmodels (i.e. referenced)
  • Add support for owned has_many associations to root viewmodels (i.e. referenced)
  • Decide whether we want to constrain AssociationManipulation to only work with external associations and vice versa.
  • Add tests for owned ref has one
  • Add tests for owned ref has many

@chrisandreae chrisandreae force-pushed the root-viewmodels branch 2 times, most recently from 8c083c2 to 362d98e Compare May 24, 2019 10:28
lib/view_model/active_record/cloner.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/visitor.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/update_operation.rb Outdated Show resolved Hide resolved
case fupdate
when FunctionalUpdate::Append
# If we're referring to existing members, ensure that they're removed before we append/insert
existing_refs = fupdate.contents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the old name. I thought existing_refs was like child_datas, ie, the before state. The variable holds exactly the refs that are being moved by the current append action.

@chrisandreae
Copy link
Member Author

Decide whether we want to constrain AssociationManipulation to only work with external associations and vice versa.

Punt on doing this for now, because it'll affect a lot of the tests, but I think that we're going to want to do this. #126

lib/view_model/deserialization_error.rb Outdated Show resolved Hide resolved
lib/view_model/active_record.rb Outdated Show resolved Hide resolved
lib/view_model/active_record.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/update_data.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/update_data.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/association_manipulation.rb Outdated Show resolved Hide resolved
lib/view_model/active_record/association_manipulation.rb Outdated Show resolved Hide resolved
test/unit/view_model/access_control_test.rb Outdated Show resolved Hide resolved
Removes support for explicit shared on associations. ViewModels are now
explicitly declared as either roots or nested children.

Removes support for `optional` associations and dynamic prune/include in
seralization. Associations may now be `external`. External associations are
never (de)serialized as part of the parent, and may only be manipulated
externally with `AssociationManipulation`.

Fixes #100
@chrisandreae chrisandreae merged commit bfaa747 into master Jul 8, 2019
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

Successfully merging this pull request may close these issues.

Convert shared associations to root viewmodels and ownership.
2 participants