-
Notifications
You must be signed in to change notification settings - Fork 121
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
make user relation polymorphic #63
make user relation polymorphic #63
Conversation
@ledermann I didn't add new tests as the test coverage is pretty good but let me know if you like to have some explicit testing for polymorphic user. |
def824d
to
6ee9bf0
Compare
@@ -27,8 +27,9 @@ def mark_array_as_read(array, user) | |||
if global_timestamp && global_timestamp >= timestamp | |||
# The object is implicitly marked as read, so there is nothing to do | |||
else | |||
rm = obj.read_marks.where(:user_id => user.id).first || obj.read_marks.build | |||
rm = obj.read_marks.where(:user_id => user.id, :user_id => user.class.base_class.name).first || obj.read_marks.build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... this must be :user_type =>
Thank you @everplays, great PR! Some additional ideas:
|
@ledermann sure. I can make these changes. However, changing |
@ledermann I've applied two of your comments (out of four). Let me know if you want to break BC so I can add the migration and change |
Fine! But as I see it we are already introducing breaking changes, because the database schema requires the new column In addition, if a developer is using the public API of the gem only, changing some column names in the In a nutshell, I prefer to rename the column names. |
@ledermann done. I've added some documentation as well. Feel free to remove/alter them. |
Great, thank you very much @everplays! Will merge it soon... |
We need to iterate through all defined reader classes Belongs to #63
fixes #33.