Sha256: 714f55f4509021b2c52044c034806ff28c1bce29d8afd6129d30bee07ffd832e

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 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.feed_key(self.user_id), DateTime.parse(self.created_at).to_i, self.id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_feed-1.2 lib/activity_feed/ohm/item.rb