Class: ExternalLink

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

Instance Method Summary collapse

Instance Method Details

#default_icon_urlObject



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

def default_icon_url
  # NOTE: the below will add an asset digest, so
  # URLS may break if assets are changed in the future
  ActionController::Base.helpers.image_url("links-#{name}.png")
end

#icon_url(resize = '64x64') ⇒ Object



10
11
12
13
14
# File 'app/models/external_link.rb', line 10

def icon_url(resize = '64x64')
  return icon_variant_url(resize: resize) if icon.attached? && icon.variable?

  default_icon_url
end