Sha256: f160b4f73f15bd6a7512fd12e8a534238e17b44747886f1d1bcaa018e33e7073

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

require 'spec_helper'
require 'mongoid'

Mongoid.configure do |config|
  config.master = Mongo::Connection.new.db("activity_feed_gem_test")
end

DatabaseCleaner[:mongoid].strategy = :truncation

module ActivityFeed
  module Mongoid
    class Item
      include ::Mongoid::Document    
      include ::Mongoid::Timestamps

      field :user_id, :type => String
      validates_presence_of :user_id

      field :nickname, :type => String
      field :type, :type => String
      field :title, :type => String
      field :text, :type => String
      field :url, :type => String
      field :icon, :type=> String
      field :sticky, :type=> Boolean

      index :user_id

      after_save :update_activity_feed

      private

      def update_activity_feed
        ActivityFeed.update_item(self.user_id, self.id, self.created_at.to_i)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activity_feed-2.2.0 spec/support/mongoid.rb
activity_feed-2.1.0 spec/support/mongoid.rb
activity_feed-2.0.0 spec/support/mongoid.rb
activity_feed-2.0.0.rc1 spec/support/mongoid.rb