Class: GacoCms::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/gaco_cms/application_record.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.human_name(args = {}) ⇒ Object



20
21
22
# File 'app/models/gaco_cms/application_record.rb', line 20

def human_name(args = {})
  model_name.human(args)
end

Instance Method Details

#activestorage_url(file) ⇒ Object



11
12
13
14
15
16
# File 'app/models/gaco_cms/application_record.rb', line 11

def activestorage_url(file)
  return '' unless file&.blob
  return file.url.split('?').first if file.service.name == :amazon

  Rails.application.routes.url_helpers.rails_blob_path(file, only_path: true)
end

#cache_key_locale(*keys) ⇒ Object



7
8
9
# File 'app/models/gaco_cms/application_record.rb', line 7

def cache_key_locale(*keys)
  "#{cache_key_with_version}/#{I18n.locale}/#{keys.join('-')}"
end