lib/activity_feed.rb in activity_feed-1.3.0 vs lib/activity_feed.rb in activity_feed-1.4.0

- old
+ new

@@ -24,10 +24,13 @@ require 'activity_feed/memory/item' klazz = ActivityFeed::Memory::Item when :mongo_mapper require 'activity_feed/mongo_mapper/item' klazz = ActivityFeed::MongoMapper::Item + when :mongoid + require 'activity_feed/mongoid/item' + klazz = ActivityFeed::Mongoid::Item when :ohm require 'activity_feed/ohm/item' klazz = ActivityFeed::Ohm::Item else klazz = "ActivityFeed::#{type.to_s.classify}::Item".constantize @@ -48,11 +51,11 @@ end def self.aggregate_item(item, user_id = nil) user_id_for_aggregate = user_id.nil? ? item.user_id : user_id case @@persistence_type - when :active_record, :mongo_mapper + when :active_record, :mongo_mapper, :mongoid ActivityFeed.redis.zadd(ActivityFeed.feed_key(user_id_for_aggregate, true), item.created_at.to_i, item.id) when :ohm ActivityFeed.redis.zadd(ActivityFeed.feed_key(user_id_for_aggregate, true), DateTime.parse(item.created_at).to_i, item.id) else ActivityFeed.redis.zadd(ActivityFeed.feed_key(user_id_for_aggregate, true), DateTime.now.to_i, item.attributes.to_json) @@ -65,9 +68,11 @@ ActivityFeed::ActiveRecord::Item.find(item_or_item_id) when :memory JSON.parse(item_or_item_id) when :mongo_mapper ActivityFeed::MongoMapper::Item.find(item_or_item_id) + when :mongoid + ActivityFeed::Mongoid::Item.find(item_or_item_id) when :ohm ActivityFeed::Ohm::Item[item_or_item_id] else @@persistence.find(item_or_item_id) end