Sha256: 7b93b8e741e139500f327c67090a315994b8bb548ee35eb755ca151dec45c7fc

Contents?: true

Size: 591 Bytes

Versions: 5

Compression:

Stored size: 591 Bytes

Contents

module Streamit
  module ORM
    module ActiveRecord
      extend  ActiveSupport::Concern
      include Streamit::Store
      
      included do
        belongs_to :actor,    :polymorphic => true
        belongs_to :subject,  :polymorphic => true
        belongs_to :receiver, :polymorphic => true
        
        default_scope order("started_at DESC")
        scope :ago,   lambda { |num| where ["started_at > ?", Time.now - num.to_i.seconds] }
        scope :after, lambda { |id| where("id > #{id}") }
      end
      
      def save_stream!
        save!
      end
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
streamit-0.0.5 lib/streamit/orm/active_record.rb
streamit-0.0.4 lib/streamit/orm/active_record.rb
streamit-0.0.3 lib/streamit/orm/active_record.rb
streamit-0.0.1 lib/streamit/orm/active_record.rb
streamit-0.0.0 lib/streamit/orm/active_record.rb