Skip to content

Comments

Allow for resource to be nil when broadcasting a collection#14

Closed
adampal wants to merge 1 commit intoleastbad:stream_updatesfrom
adampal:stream_updates
Closed

Allow for resource to be nil when broadcasting a collection#14
adampal wants to merge 1 commit intoleastbad:stream_updatesfrom
adampal:stream_updates

Conversation

@adampal
Copy link

@adampal adampal commented Sep 14, 2021

  • If you have a has_many optional: true relationship the resource
    may not exist. Prior to this change, the broadcast for all resources
    would fail if any of them were optional and didn't exist on the
    parent.

* If you have a `has_many optional: true` relationship the resource
  may not exist.  Prior to this change, the broadcast for all resources
  would fail if any of them were optional and didn't exist on the
  parent.
@julianrubisch
Copy link

@adampal I'm having a bit of a hard time grokking what you mean, given that I don't know a has_many optional:true, only a belongs_to optional: true

With my latest refactoring the implementation has changed a bit, and I want to help. I've put up a test case here:

https://github.com/leastbad/cable_ready/pull/16/files

but can't get it to fail. Could you take a look at this? Thanks 🙏

@adampal
Copy link
Author

adampal commented Sep 21, 2021

@julianrubisch sorry, that was a typo in my PR. It should have said belongs_to optional: true.
Thanks for adding the test case. Let me check it out and see if I can replicate the issue I was seeing in the app I was working on.

@julianrubisch
Copy link

That would be awesome, thanks! Sorry for the inconvenience, I think it makes sense to have that properly backed by a test.

@erlingur
Copy link

@julianrubisch I commented on your PR with a "fix" to make it fail :)

@julianrubisch
Copy link

Thanks all! Fixed in #16

@leastbad
Copy link
Owner

Great work, team. Thanks for the contribution, @adampal!

@leastbad leastbad closed this Sep 22, 2021
@adampal adampal deleted the stream_updates branch September 23, 2021 04:01
@adampal
Copy link
Author

adampal commented Sep 23, 2021

Thanks everyone. Glad we got it resolved so easily!

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.

4 participants