Sha256: 4cc92db0270b70d51fdf1ab3e40a17fe4438a68898abd993f922107c2b6ddbf0

Contents?: true

Size: 391 Bytes

Versions: 65

Compression:

Stored size: 391 Bytes

Contents

module Alchemy::Language::Code
  extend ActiveSupport::Concern

  def code
    [language_code, country_code].select(&:present?).join('-')
  end

  def code=(code)
    self.language_code = code
  end

  module ClassMethods

    def find_by_code(code)
      codes = code.split('-')
      codes << '' if codes.length == 1
      find_by_language_code_and_country_code *codes
    end

  end

end

Version data entries

65 entries across 65 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 app/models/alchemy/language/code.rb
alchemy_cms-3.1.3 app/models/alchemy/language/code.rb
lc_alchemy_cms-3.2.1 app/models/alchemy/language/code.rb
lc_alchemy_cms-3.2.0 app/models/alchemy/language/code.rb
alchemy_cms-3.2.0 app/models/alchemy/language/code.rb
alchemy_cms-3.2.0.rc1 app/models/alchemy/language/code.rb
alchemy_cms-3.2.0.beta app/models/alchemy/language/code.rb
alchemy_cms-2.9.1 app/models/alchemy/language/code.rb
alchemy_cms-3.1.1 app/models/alchemy/language/code.rb
alchemy_cms-3.0.4 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.rc3 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.rc2 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.rc1 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.beta6 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.beta5 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.beta4 app/models/alchemy/language/code.rb
alchemy_cms-3.0.3 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.beta3 app/models/alchemy/language/code.rb
alchemy_cms-3.1.0.beta2 app/models/alchemy/language/code.rb