Sha256: bc436ff57baf191b26b0b872462fe624e38db35d1ea1cc9e177a9ba10dd6f24d

Contents?: true

Size: 765 Bytes

Versions: 9

Compression:

Stored size: 765 Bytes

Contents

require 'active_record'

ActiveRecord::Base.establish_connection(
  :adapter => "sqlite3",
  :database => ":memory:"
)

ActiveRecord::Migration.verbose = false

DatabaseCleaner[:active_record].strategy = :transaction

ActiveRecord::Schema.define do
  create_table :activity_feed_items, :force => true do |t|
    t.string :user_id
    t.string :nickname
    t.string :type
    t.string :title
    t.text :body
    
    t.timestamps
  end
end

module ActivityFeed
  module ActiveRecord
    class Item < ::ActiveRecord::Base
      set_table_name 'activity_feed_items'
        
      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

9 entries across 9 versions & 1 rubygems

Version Path
activity_feed-3.1.0 spec/support/active_record.rb
activity_feed-3.0.1 spec/support/active_record.rb
activity_feed-3.0.0 spec/support/active_record.rb
activity_feed-2.3.0 spec/support/active_record.rb
activity_feed-2.2.2 spec/support/active_record.rb
activity_feed-2.2.0 spec/support/active_record.rb
activity_feed-2.1.0 spec/support/active_record.rb
activity_feed-2.0.0 spec/support/active_record.rb
activity_feed-2.0.0.rc1 spec/support/active_record.rb