Skip to content

New model for root viewmodels#121

Merged
chrisandreae merged 1 commit intomasterfrom
root-viewmodels
Jul 8, 2019
Merged

New model for root viewmodels#121
chrisandreae merged 1 commit intomasterfrom
root-viewmodels

Conversation

@chrisandreae
Copy link
Copy Markdown
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
Comment thread lib/view_model/active_record/cloner.rb Outdated
Comment thread lib/view_model/active_record/visitor.rb Outdated
Comment thread lib/view_model/active_record/update_operation.rb Outdated
Comment thread lib/view_model/active_record/update_operation.rb
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
Copy Markdown
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.

Comment thread lib/view_model/active_record/update_operation.rb
@chrisandreae
Copy link
Copy Markdown
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

Comment thread lib/view_model/deserialization_error.rb Outdated
Comment thread lib/view_model/active_record.rb Outdated
Comment thread lib/view_model/active_record.rb Outdated
Comment thread lib/view_model/active_record/update_data.rb Outdated
Comment thread lib/view_model/active_record/update_data.rb Outdated
Comment thread lib/view_model/active_record/association_manipulation.rb Outdated
Comment thread lib/view_model/active_record/association_manipulation.rb Outdated
Comment thread test/unit/view_model/access_control_test.rb Outdated
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