Git Product home page Git Product logo

Comments (3)

ledermann avatar ledermann commented on May 18, 2024

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.

bricker avatar bricker commented on May 18, 2024

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.

ledermann avatar ledermann commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.