Module: Concerns::Seo

Extended by:
ActiveSupport::Concern
Included in:
Article, Page
Defined in:
app/models/concerns/seo.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#seo(locale = I18n.locale) ⇒ Object



41
42
43
44
45
46
47
# File 'app/models/concerns/seo.rb', line 41

def seo(locale = I18n.locale)
  @seo_collections = {} unless @seo_collections
  return @seo_collections[locale.to_sym] if @seo_collections[locale.to_sym]

  existing_meta = meta.find_by(locale: locale)
  @seo_collections[locale.to_sym] = existing_meta ? existing_meta : meta.new(locale: locale)
end