Class: Translation

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



14
15
16
17
18
19
20
# File 'app/models/translation.rb', line 14

def method_missing(sym, *args)
  if ActiveadminSelleoCms::Locale.enabled.map(&:code).include?(sym)
    Translation.where(locale: sym, key: key).first || ""
  else
    super
  end
end

Instance Method Details

#to_sObject



22
23
24
# File 'app/models/translation.rb', line 22

def to_s
  value.to_s
end