Class: Node

Inherits:
ApplicationRecord show all
Defined in:
app/models/node.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jobs_idObject

招聘节点编号


24
25
26
# File 'app/models/node.rb', line 24

def self.jobs_id
  25
end

.new_topic_dropdownsObject


45
46
47
48
49
# File 'app/models/node.rb', line 45

def self.new_topic_dropdowns
  return [] if Setting.new_topic_dropdown_node_ids.blank?
  node_ids = Setting.new_topic_dropdown_node_ids.split(',').uniq.take(5)
  where(id: node_ids)
end

.no_point_idObject

NoPoint 节点编号


29
30
31
# File 'app/models/node.rb', line 29

def self.no_point_id
  61
end

Instance Method Details

#jobs?Boolean

是否为 jobs 节点

Returns:

  • (Boolean)

41
42
43
# File 'app/models/node.rb', line 41

def jobs?
  id == self.class.jobs_id
end

#summary_htmlObject

Markdown 转换过后的 HTML


34
35
36
37
38
# File 'app/models/node.rb', line 34

def summary_html
  Rails.cache.fetch("#{cache_key}/summary_html") do
    MarkdownTopicConverter.convert(summary)
  end
end

#update_cache_versionObject


18
19
20
21
# File 'app/models/node.rb', line 18

def update_cache_version
  # 记录节点变更时间,用于清除缓存
  CacheVersion.section_node_updated_at = Time.now
end