Class Language
In: app/models/language.rb
Parent: ActiveRecord::Base

言語のモデル。

Methods

all   default_code   to_h  

Classes and Modules

Class Language::LanguageNotFound

Public Class methods

利用可能な全言語を返す。

[Source]

    # File app/models/language.rb, line 28
28:   def self.all
29:     find(:all, :order => "id")
30:   end

既定の言語のコードを返す。

[Source]

    # File app/models/language.rb, line 40
40:   def self.default_code
41:     if lang = find(:first, :order => "id")
42:       return lang.code
43:     end
44:     raise LanguageNotFound
45:   end

全言語の id と code の対からなるハッシュを返す。

[Source]

    # File app/models/language.rb, line 33
33:   def self.to_h
34:     h = {}
35:     all.each {|lang| h[lang.id] = lang.code}
36:     return h
37:   end

[Validate]