Sha256: bb0a9b45bfc13aae505e9c6fe9b3914caed083c5c1471d7c6200ea22b3eda53b

Contents?: true

Size: 509 Bytes

Versions: 23

Compression:

Stored size: 509 Bytes

Contents

class Dorsale::Comment < ::Dorsale::ApplicationRecord
  belongs_to :author, class_name: "User"
  belongs_to :commentable, polymorphic: true

  validates :author,      presence: true
  validates :commentable, presence: true
  validates :text,        presence: true
  validates :date,        presence: true

  default_scope -> {
    all
      .order(created_at: :desc, id: :desc)
      .preload(:author, :commentable)
  }

  private

  def assign_default_values
    assign_default :date, Date.current
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
dorsale-4.0.0 app/models/dorsale/comment.rb
dorsale-3.20.0 app/models/dorsale/comment.rb
dorsale-3.19.1 app/models/dorsale/comment.rb
dorsale-3.19.0 app/models/dorsale/comment.rb
dorsale-3.18.0 app/models/dorsale/comment.rb
dorsale-3.17.0 app/models/dorsale/comment.rb
dorsale-3.16.0 app/models/dorsale/comment.rb
dorsale-3.15.0 app/models/dorsale/comment.rb
dorsale-3.14.11 app/models/dorsale/comment.rb
dorsale-3.14.10 app/models/dorsale/comment.rb
dorsale-3.14.9 app/models/dorsale/comment.rb
dorsale-3.14.8 app/models/dorsale/comment.rb
dorsale-3.14.7 app/models/dorsale/comment.rb
dorsale-3.14.6 app/models/dorsale/comment.rb
dorsale-3.14.5 app/models/dorsale/comment.rb
dorsale-3.14.4 app/models/dorsale/comment.rb
dorsale-3.14.3 app/models/dorsale/comment.rb
dorsale-3.14.2 app/models/dorsale/comment.rb
dorsale-3.14.1 app/models/dorsale/comment.rb
dorsale-3.14.0 app/models/dorsale/comment.rb