module Redcrumbs::Users
Provides methods for giving user context to crumbs. Retrieves crumbs created by a user (creator) or affecting a user (target)
Public Instance Methods
crumbs_as_user(opts = {})
click to toggle source
Or queries don’t seem to be working with dm-redis-adapter. This is a temporary workaround.
# File lib/redcrumbs/users.rb, line 26 def crumbs_as_user(opts = {}) opts[:limit] ||= 100 arr = crumbs_by.to_a + crumbs_for.to_a arr.uniq! arr.sort_by! {|c| [c.created_at, c.id]}.reverse end
crumbs_by(opts = {})
click to toggle source
Retrieves crumbs created by the user
# File lib/redcrumbs/users.rb, line 17 def crumbs_by(opts = {}) klass = Redcrumbs.crumb_class klass.created_by(self).all(opts) end
crumbs_for(opts = {})
click to toggle source
Retrieves crumbs related to the user
# File lib/redcrumbs/users.rb, line 9 def crumbs_for(opts = {}) klass = Redcrumbs.crumb_class klass.targetted_by(self).all(opts) end