Class: Comment

Inherits:
ApplicationRecord show all
Includes:
BaseModel, MarkdownBody
Defined in:
app/models/comment.rb

Constant Summary

Constants included from ApplicationHelper

ApplicationHelper::ALLOW_ATTRIBUTES, ApplicationHelper::ALLOW_TAGS, ApplicationHelper::EMPTY_STRING, ApplicationHelper::LANGUAGES_LISTS, ApplicationHelper::MOBILE_USER_AGENTS

Instance Method Summary collapse

Methods included from ApplicationHelper

#admin?, #birthday_tag, #cache, #cached_asset_path, #controller_javascript_include_tag, #controller_stylesheet_link_tag, #highlight, #icon_tag, #insert_code_menu_items_tag, #javascript_include_tag_with_cached, #memory_cache, #mobile?, #notice_message, #owner?, #random_tips, #render_list, #render_page_title, #sanitize_markdown, #spaceless, #stylesheet_link_tag_with_cached, #timeago, #wiki_editor?

Methods included from BaseModel

#pull, #push

Instance Method Details

#decrease_counter_cacheObject


22
23
24
25
# File 'app/models/comment.rb', line 22

def decrease_counter_cache
  return if commentable.blank?
  commentable.decrement!(:comments_count)
end

#fix_commentable_idObject


11
12
13
# File 'app/models/comment.rb', line 11

def fix_commentable_id
  self.commentable_id = commentable_id.to_i
end

#increase_counter_cacheObject


16
17
18
19
# File 'app/models/comment.rb', line 16

def increase_counter_cache
  return if commentable.blank?
  commentable.increment!(:comments_count)
end