Class: Homeland::Reply

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::Markup, Concerns::SoftDelete, Concerns::UserDelegates
Defined in:
app/models/homeland/reply.rb

Instance Method Summary collapse

Methods included from Concerns::UserDelegates

#user_admin?

Methods included from Concerns::Markup

#render_markup

Methods included from Concerns::SoftDelete

#deleted?, #destroy

Instance Method Details

#update_topic_last_reply_atObject


20
21
22
23
24
25
26
27
# File 'app/models/homeland/reply.rb', line 20

def update_topic_last_reply_at
  return if self.topic.blank?
  self.topic.replied_at = Time.now
  self.topic.last_active_mark = Time.now.to_i
  self.topic.last_reply_user_id = self.user_id
  self.topic.replies_count = self.topic.replies.count
  self.topic.save
end