Module: Alchemy::Language::Code::ClassMethods

Defined in:
app/models/alchemy/language/code.rb

Instance Method Summary collapse

Instance Method Details

#find_by_code(code) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/models/alchemy/language/code.rb', line 15

def find_by_code(code)
  codes = code.split("-")
  codes << "" if codes.length == 1
  on_current_site.find_by(
    language_code: codes[0],
    country_code: codes[1]
  )
end