Sha256: b6235d46abc3cbb7b6b3622c740f20edcad61552f5b5ce5f21d5708d961fdcbd

Contents?: true

Size: 683 Bytes

Versions: 11

Compression:

Stored size: 683 Bytes

Contents

module SocialNetworking
  # A statement by a Participant to be shared with the Group.
  class OnTheMindStatement < ActiveRecord::Base
    belongs_to :participant
    has_many :comments, as: "item", dependent: :destroy
    has_many :likes, as: "item", dependent: :destroy

    validates :participant, :description, presence: true

    scope :for_today, lambda {
      where(
        "created_at <= ? AND created_at >= ?",
        Date.today.end_of_day,
        Date.today.beginning_of_day
      )
    }

    scope :for_week, lambda {
      where("created_at >= ?", Time.current.advance(days: -7).beginning_of_day)
    }

    def shared_description
      description
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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