Git Product home page Git Product logo

Comments (8)

ledermann avatar ledermann commented on May 18, 2024

You are right, I will remove this dependency soon.

from unread.

ledermann avatar ledermann commented on May 18, 2024

It should be fixed now, so you can use an other class as reader, e.g.:

class Account < ActiveRecord::Base
  acts_as_reader
end

Please re-open this ticket if there is still an issue.

from unread.

chalmagean avatar chalmagean commented on May 18, 2024

It doesn't seem to be working:

ruby-1.9.2-p290 :002 > QuoteRequestComment.unread_by(a)
  ReadMark Load (0.3ms)  SELECT `read_marks`.* FROM `read_marks` WHERE `read_marks`.`account_id` = 1 AND `read_marks`.`readable_type` = 'QuoteRequestComment' AND `read_marks`.`readable_id` IS NULL LIMIT 1
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'read_marks.account_id' in 'where clause': SELECT  `read_marks`.* FROM `read_marks`  WHERE `read_marks`.`account_id` = 1 AND `read_marks`.`readable_type` = 'QuoteRequestComment' AND `read_marks`.`readable_id` IS NULL LIMIT 1

from unread.

ledermann avatar ledermann commented on May 18, 2024

Argh! There was no test case, so it fails. Sorry, it's fixed now, and the tests are updated, too.

from unread.

chalmagean avatar chalmagean commented on May 18, 2024

here's another backtrace from 0.6

ruby-1.9.2-p290 :002 > QuoteRequestComment.unread_by(a)
  ReadMark Load (0.6ms)  SELECT `read_marks`.* FROM `read_marks` WHERE `read_marks`.`account_id` = 1 AND `read_marks`.`readable_type` = 'QuoteRequestComment' AND `read_marks`.`readable_id` IS NULL LIMIT 1
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'read_marks.account_id' in 'where clause': SELECT  `read_marks`.* FROM `read_marks`  WHERE `read_marks`.`account_id` = 1 AND `read_marks`.`readable_type` = 'QuoteRequestComment' AND `read_marks`.`readable_id` IS NULL LIMIT 1
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:687:in `query'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:687:in `block in exec_query'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activesupport-3.1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:685:in `exec_query'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:679:in `select'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/base.rb:470:in `find_by_sql'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/relation.rb:111:in `to_a'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/relation/finder_methods.rb:376:in `find_first'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/relation/finder_methods.rb:122:in `first'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@sparts/gems/unread-0.0.6/lib/unread/acts_as_readable.rb:82:in `read_mark'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@sparts/gems/unread-0.0.6/lib/unread/acts_as_readable.rb:86:in `read_timestamp'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@sparts/gems/unread-0.0.6/lib/unread/acts_as_readable.rb:44:in `block in acts_as_readable'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/named_scope.rb:179:in `call'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.1/lib/active_record/named_scope.rb:179:in `block in scope'

from unread.

ledermann avatar ledermann commented on May 18, 2024

Hm, this error is the same as you mentioned before. My fix (e7eae0a) should solve this error. Because of setting :foreign_key it should work with other reader classes.

I have built a sample application with Ruby 1.9.2, ActiveRecord 3.1.1, Unread 0.0.6 and an Account class - it works fine.

Very strange. I have no idea what is going wrong here. I would appreciate to get some informations to reproduce this.

from unread.

chalmagean avatar chalmagean commented on May 18, 2024

I was my fault, I had a has_many :read_marks line left in the account model, everything works fine now, thanks

from unread.

ezuhaib avatar ezuhaib commented on May 18, 2024

Can we set multiple models as readers, by including acts_as_reader in more than one model?

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.