Sha256: efbd64f8807fd406885443e3890677cbf7fb01ce8c951ee6ab9d16e20ca16000

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true
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(Time.zone.today.beginning_of_day)
                .and(arel_table[:created_at].lteq(Time.zone.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

4 entries across 4 versions & 1 rubygems

Version Path
social_networking-0.13.2 app/models/social_networking/comment.rb
social_networking-0.13.1 app/models/social_networking/comment.rb
social_networking-0.13.0 app/models/social_networking/comment.rb
social_networking-0.12.0 app/models/social_networking/comment.rb