Sha256: c45c7ec57812e1e0148cb78a40ef0d0594b0cb51697a65c83737fec5d53ad19a

Contents?: true

Size: 930 Bytes

Versions: 19

Compression:

Stored size: 930 Bytes

Contents

class Language < ApplicationRecord
  include MasterModel
  # If you wish to change the field names for brevity, feel free to enable/modify these.
  # alias_attribute :iso1, :iso_639_1
  # alias_attribute :iso2, :iso_639_2
  # alias_attribute :iso3, :iso_639_3

  # Validations
  validates :iso_639_1, :iso_639_2, :iso_639_3, presence: true
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }

  def self.available_languages
    Language.where(iso_639_1: I18n.available_locales.map{|l| l.to_s}).order(:position)
  end

  private

  def valid_name?
    true
  end
end

# == Schema Information
#
# Table name: languages
#
#  id           :integer          not null, primary key
#  name         :string           not null
#  native_name  :string
#  display_name :text
#  iso_639_1    :string
#  iso_639_2    :string
#  iso_639_3    :string
#  note         :text
#  position     :integer
#

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 app/models/language.rb
enju_biblio-0.3.17 app/models/language.rb
enju_biblio-0.3.16 app/models/language.rb
enju_biblio-0.3.15 app/models/language.rb
enju_biblio-0.3.14 app/models/language.rb
enju_biblio-0.3.13 app/models/language.rb
enju_biblio-0.3.12 app/models/language.rb
enju_biblio-0.3.11 app/models/language.rb
enju_biblio-0.3.10 app/models/language.rb
enju_biblio-0.3.10.rc.3 app/models/language.rb
enju_biblio-0.3.10.rc.2 app/models/language.rb
enju_biblio-0.3.10.rc.1 app/models/language.rb
enju_biblio-0.3.9 app/models/language.rb
enju_biblio-0.3.8 app/models/language.rb
enju_biblio-0.3.7 app/models/language.rb
enju_biblio-0.3.6 app/models/language.rb
enju_biblio-0.3.5 app/models/language.rb
enju_biblio-0.3.4 app/models/language.rb
enju_biblio-0.3.3 app/models/language.rb