ledermann / unread

Handle unread records and mark them as read with Ruby on Rails
MIT License
739 stars 121 forks source link

"ArgumentError: Class User is not registered by acts_as_readable." #92

Closed chriscaple closed 6 years ago

chriscaple commented 7 years ago

I haven't been able to get this to work at all. Rails 5.1. Seems to be set up correctly. I have a User model and a Message model. User has acts_as_reader, Message has acts_as_readable on: :created_at. The initial gem migration has been run. The read_marks table exists.

But... if I try to run any of the gem's commands in the console, like for example -

Message.read_by(someuser)

(where someuser is a variable with one user assigned to it), I get -

ArgumentError: Class User is not registered by acts_as_readable.

Any idea what that's about? I've googled around and haven't found much. Nor has digging into the code been illuminating to this point. I mean... as far as I can tell, this is set up correctly. But it's not tracking read/unread messages per user.

ledermann commented 6 years ago

Seems like a class loading issue. Make sure the class User is loaded before.