Comments (3)
Please make sure to call "acts_as_reader" only one time in the User class. Every time the callback "after_create" is added.
The recent commit will raise an exception if the acts_as methods are called multiple times. Please check it out and tell me if this helps.
from unread.
Thank you for the quick response.
I updated the gem to reflect your commit. I am indeed getting the exception you added, however the "acts_as_reader" is only called once in the User model. When I remove the line, the exception goes away, however I then get an "Argument Error" on the line referencing Topic.unread_by(@current_user)
:
@unread_topics = Topic.unread_by(@current_user) # topics_controller
@unread_topics.include?(topic) # topics_controller#index - raises error on this line
# Error
ArgumentError in Cp::TopicsController#index
ArgumentError
In my User model I have acts_as_reader
, and in my Topic model I have acts_as_readable :on => :updated_at
, and the schema for the read_marks table is identical to your example in the readme.
As it stands, this commit has broken the gem for me, as I either get an ArgumentError or the exception you added. I hope to get this resolved soon. Thanks again for such a cool gem!
from unread.
Thanks for the feedback. IMHO there is an issue in your code causing multiple class loading. Because raising exception seems not to be the best way handling this I have changed the gem to just ignore multiple calls. Please, try again with the latest source.
BTW: You can use this prelease gem by adding this to your Gemfile:
gem 'unread', :git => 'git://github.com/ledermann/unread.git'
from unread.
Related Issues (20)
- Utilizing current time instead of matching reference timestamp field HOT 6
- operator does not exist: integer = uuid HOT 4
- Create a mark_as_read method (without !)
- seeing n+1 queries even if using with_read_marks_for HOT 2
- Full Table Scan on Insert Causes Deadlock
- Migration contain `null` value for timestamps
- issue with mark_as_read! method HOT 1
- ReadMark.readable_classes is nil until the first use
- Adding a new .read?(current_user) instance method in readable.rb InstanceMethods
- UnreadMigration timestamp column without precision option for rails 6 HOT 1
- Only get NULL timestamp HOT 2
- mark_as_read! :all, for: current_user is not working as intended HOT 1
- mark_as_read! fails with exception on Rails 6+ if Reader has default_scope defined
- problems with uuid indexes HOT 1
- Project dead? HOT 4
- Performance question with indexes HOT 1
- Argument Error on User's Save
- `cleanup_read_marks` killing database CPU for hours? HOT 1
- Mark as read for all HOT 1
- mark_as_read! :all for associations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unread.