Sha256: 9acadd4f4bab4f2d2d4b42157fc31763a3dedc2681dae14584eb3fd4d94de593
Contents?: true
Size: 471 Bytes
Versions: 1
Compression:
Stored size: 471 Bytes
Contents
class Activity include Mongoid::Document embedded_in :actionable, polymorphic: true field :recommend, type: Hash field :view, type: Hash field :visit, type: Hash field :_id, type: String, default: nil def activities_of_user(user_id) result = {} self.attributes.each {|k,v| result[k] = { 'id' => (v.include?(user_id.to_s) ? v[user_id.to_s] || true : false), 'count' => v.try(:length) } } result end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
models-0.0.22.1 | app/models/activity.rb |