Class: Hub::Reply
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Hub::Reply
- Includes:
- SoftDelete, Uid
- Defined in:
- app/models/hub/reply.rb
Constant Summary collapse
- INVALID_CHARS =
%w( ).freeze
Instance Method Summary collapse
- #body_content_valid? ⇒ Boolean
- #corrected_body_content ⇒ Object
- #update_topic_last_reply_at ⇒ Object
Methods included from SoftDelete
Instance Method Details
#body_content_valid? ⇒ Boolean
35 36 37 38 39 |
# File 'app/models/hub/reply.rb', line 35 def body_content_valid? INVALID_CHARS.all? do |invalid_char| body.index(invalid_char).nil? end end |
#corrected_body_content ⇒ Object
41 42 43 44 45 46 |
# File 'app/models/hub/reply.rb', line 41 def corrected_body_content INVALID_CHARS.each do |invalid_char| body.gsub!(invalid_char, '') end body end |
#update_topic_last_reply_at ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/models/hub/reply.rb', line 25 def update_topic_last_reply_at return if topic.blank? topic.replied_at = Time.current topic.last_active_mark = Time.now.to_i topic.replies_count = topic.replies.count topic.save end |