Comments (8)
You are right, I will remove this dependency soon.
from unread.
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.
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.
Argh! There was no test case, so it fails. Sorry, it's fixed now, and the tests are updated, too.
from unread.
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.
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.
I was my fault, I had a has_many :read_marks line left in the account model, everything works fine now, thanks
from unread.
Can we set multiple models as readers, by including acts_as_reader
in more than one model?
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
- New users has every notification as read.
- 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.