Mark as read for all
cpanderson opened this issue · 1 comments
cpanderson commented
As per the example...
Model.mark_as_read! :all, for: current_user
...when I try to use this in the console it looks like it's expecting more like it's missing a closing bracket or something...
2.3.1 :009 > Model.mark_as_read!(:all, for: User.find(1))
2.3.1 :010?>
Even if I don't enclose it in brackets as per the example. Am I referencing this wrong?
I have the latest version of the gem. Thanks!
ledermann commented
Hm, I don't where the question mark comes from. In a Rails application which uses the gem I get the following output:
$ rails c
Loading development environment (Rails 5.1.5)
irb(main):001:0> Activity.mark_as_read! :all, for: User.find(1)
(0.4ms) SET NAMES utf8mb4, @@SESSION.sql_mode = 'ONLY_FULL_GROUP_BY', @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
(0.1ms) BEGIN
SQL (0.3ms) DELETE FROM `read_marks` WHERE `read_marks`.`reader_id` = 1 AND `read_marks`.`reader_type` = 'User' AND `read_marks`.`readable_type` = 'Activity'
SQL (0.3ms) INSERT INTO `read_marks` (`account_id`, `reader_id`, `readable_type`, `timestamp`, `reader_type`) VALUES (1, 1, 'Activity', '2018-03-08 07:42:51', 'User')
(5.8ms) COMMIT
nil
irb(main):002:0>