Sha256: 9a0f503eb98db12cd15fc0b9dcb99285e121edb99b2e9f8b9ee6887d84fbc1d6

Contents?: true

Size: 618 Bytes

Versions: 11

Compression:

Stored size: 618 Bytes

Contents

module SocialNetworking
  # A comment written by a Participant and attached to a piece of content.
  class Comment < ActiveRecord::Base
    belongs_to :participant
    belongs_to :item, polymorphic: true

    validates :participant, :item, :text, presence: true

    scope :for_today, lambda {
      where(arel_table[:created_at]
                .gteq(Date.today.beginning_of_day)
                .and(arel_table[:created_at].lteq(Date.today.end_of_day)))
    }

    scope :for_week, lambda {
      where(arel_table[:created_at]
                 .gteq(Time.current.advance(days: -7).beginning_of_day))
    }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 app/models/social_networking/comment.rb
social_networking-0.11.7 app/models/social_networking/comment.rb
social_networking-0.11.6 app/models/social_networking/comment.rb
social_networking-0.11.5 app/models/social_networking/comment.rb
social_networking-0.11.4 app/models/social_networking/comment.rb
social_networking-0.11.3 app/models/social_networking/comment.rb
social_networking-0.11.2 app/models/social_networking/comment.rb
social_networking-0.11.1 app/models/social_networking/comment.rb
social_networking-0.11.0 app/models/social_networking/comment.rb
social_networking-0.10.0 app/models/social_networking/comment.rb
social_networking-0.9.3 app/models/social_networking/comment.rb