unread icon indicating copy to clipboard operation
unread copied to clipboard

mark_as_read! for ActiveRecord::CollectionProxies

Open lowjoel opened this issue 8 years ago • 7 comments

Currently, Model.mark_as_read!(Model.all.some_scope, for: current_user) will raise ArgumentError, since the scope is not an Array. Can it be relaxed so that any Enumerable can be used instead?

lowjoel avatar Apr 08 '16 07:04 lowjoel

Or, maybe even better, mark_as_read! should be a scope method, then we can mark an entire scope as read. That might even be more efficient since the insertions and selects can be one single query.

lowjoel avatar Apr 08 '16 07:04 lowjoel

Is there progress?

yukitoto avatar Jun 10 '16 00:06 yukitoto

Is there a plan of adding this?

GuskiS avatar Feb 09 '17 21:02 GuskiS

No plan at this moment, but I'm open for a Pull Request.

ledermann avatar Feb 11 '17 12:02 ledermann

Partly done by #93 - an optimized "one query" solution for scopes is still pending.

ledermann avatar Dec 05 '17 05:12 ledermann

Hey, I was implemented it here https://github.com/ledermann/unread/pull/95.

fatkodima avatar Jan 24 '18 15:01 fatkodima

I think this is fix in v0.10.0

mark_as_read: Any collection allowed (#93, thanks to @koriroys )

https://github.com/ledermann/unread/releases

btrd avatar Aug 14 '19 20:08 btrd