Sha256: 00e81577aa3cf9f2aa4e2df73fc1bb8be4fc1ff08b38fc7b7574d53e5e0701b4

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

require 'ohm'
require 'ohm/contrib'

module ActivityFeed
  module Ohm
    class Item < ::Ohm::Model
      include ::Ohm::Callbacks
      include ::Ohm::Timestamping
      
      attribute :user_id
      attribute :nickname
      attribute :type
      attribute :title
      attribute :text
      attribute :url
      attribute :icon
      attribute :sticky      
      
      after :save, :update_redis
      
      private

      def update_redis
        ActivityFeed.redis.zadd("#{ActivityFeed.namespace}:#{ActivityFeed.key}:#{self.user_id}", self.created_at.to_i, self.id)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activity_feed-1.1.1 lib/activity_feed/ohm/item.rb
activity_feed-1.1.0 lib/activity_feed/ohm/item.rb