Sha256: 46914858123e7fee94924f08b5ea7bafaa97150c158bc6a78c6ea0b4f1653bd4
Contents?: true
Size: 635 Bytes
Versions: 3
Compression:
Stored size: 635 Bytes
Contents
class ReadMark < ActiveRecord::Base belongs_to :readable, :polymorphic => true validates_presence_of :user_id, :readable_type scope :global, lambda { where(:readable_id => nil) } scope :single, lambda { where('readable_id IS NOT NULL') } scope :older_than, lambda { |timestamp| where([ 'timestamp < ?', timestamp ]) } # Returns the class and options defined by acts_as_reader class_attribute :reader_class class_attribute :reader_options # Returns the classes defined by acts_as_readable class_attribute :readable_classes def self.reader_scope reader_options[:scope].try(:call) || reader_class end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
unread-0.6.3 | lib/unread/read_mark.rb |
unread-0.6.2 | lib/unread/read_mark.rb |
unread-0.6.1 | lib/unread/read_mark.rb |