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

mark_as_read! fails with exception on Rails 6+ if Reader has default_scope defined #120

Closed
k-rudy opened this issue Oct 29, 2020 · 0 comments

Comments

@k-rudy
Copy link
Contributor

k-rudy commented Oct 29, 2020

Hey guys,

We're having the following issue:
If the reader has default_scope defined, running mark_as_read! on readable will raise an exception:

ActiveRecord::RecordInvalid: Validation failed: Reader must exist

This is happening as belongs_to definition of the ReadMark needs to specify optional: true while it doesn't.

Thank you,
Kon.

k-rudy added a commit to Profinda/unread that referenced this issue Oct 29, 2020
k-rudy added a commit to Profinda/unread that referenced this issue Oct 30, 2020
HwakyoungLee pushed a commit to grepp/unread that referenced this issue May 12, 2023
…dermann#121)

* Added optional: true to read_marks [Fixes ledermann#120]
* Added specs for the optional reader case [Fixes ledermann#120]
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