Class: Site

Inherits:
ApplicationRecord
  • Object
show all
Includes:
SoftDelete
Defined in:
app/models/site.rb

Instance Method Summary collapse

Instance Method Details

#favicon_urlObject



19
20
21
22
23
24
25
# File 'app/models/site.rb', line 19

def favicon_url
  return "" if url.blank?
  domain = URI.parse(url.strip).host.sub("www.", "")
  "https://favicon.ruby-china.com/ip2/#{domain}.ico"
rescue
  ""
end

#update_cache_versionObject



14
15
16
17
# File 'app/models/site.rb', line 14

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