Sha256: ec87ca89c27a96985baab05f59487615436db8d117c80d1f5befc139252cfd53

Contents?: true

Size: 376 Bytes

Versions: 9

Compression:

Stored size: 376 Bytes

Contents

class SupportPost < ApplicationRecord
  belongs_to :support_thread, counter_cache: true, touch: true
  belongs_to :user
  has_many :reactions, as: :reactable

  validates :user_id, :body, presence: true

  scope :sorted, ->{ order(:created_at) }

  after_update :solve_support_thread, if: :solved?

  def solve_support_thread
    support_thread.update(solved: true)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
help_center-0.1.0 app/models/support_post.rb
help_center-0.0.9 app/models/support_post.rb
help_center-0.0.8 app/models/support_post.rb
help_center-0.0.7 app/models/support_post.rb
help_center-0.0.6 app/models/support_post.rb
help_center-0.0.4 app/models/support_post.rb
help_center-0.0.3 app/models/support_post.rb
help_center-0.0.2 app/models/support_post.rb
help_center-0.0.1 app/models/support_post.rb