Class: Ezframe::PrefectureType
- Inherits:
-
SelectType
- Object
- TypeBase
- SelectType
- Ezframe::PrefectureType
- Defined in:
- lib/ezframe/column_type.rb
Instance Attribute Summary collapse
-
#pref_h ⇒ Object
Returns the value of attribute pref_h.
Attributes inherited from TypeBase
Instance Method Summary collapse
- #form(opts = {}) ⇒ Object
-
#initialize(attr = nil) ⇒ PrefectureType
constructor
A new instance of PrefectureType.
- #view(opts = {}) ⇒ Object
Methods inherited from SelectType
Methods inherited from TypeBase
#db_type, #db_value, get_class, #key, #label, #make_error_box, #multi_inputs?, #no_edit?, #no_view?, #normalize, #type, type_name, #use_view_format, #validate, #value, #value=
Constructor Details
#initialize(attr = nil) ⇒ PrefectureType
Returns a new instance of PrefectureType.
686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'lib/ezframe/column_type.rb', line 686 def initialize(attr = nil) super(attr) @pref_a = %w[() 北海道 青森県 岩手県 宮城県 秋田県 山形県 福島県 茨城県 栃木県 群馬県 埼玉県 千葉県 東京都 神奈川県 新潟県 富山県 石川県 福井県 山梨県 長野県 岐阜県 静岡県 愛知県 三重県 滋賀県 京都府 大阪府 兵庫県 奈良県 和歌山県 鳥取県 島根県 岡山県 広島県 山口県 徳島県 香川県 愛媛県 高知県 福岡県 佐賀県 長崎県 熊本県 大分県 宮崎県 鹿児島県 沖縄県] @pref_h = {} @pref_a.each_with_index { |p, i| @pref_h[i] = p } end |
Instance Attribute Details
#pref_h ⇒ Object
Returns the value of attribute pref_h.
684 685 686 |
# File 'lib/ezframe/column_type.rb', line 684 def pref_h @pref_h end |
Instance Method Details
#form(opts = {}) ⇒ Object
699 700 701 702 703 704 705 |
# File 'lib/ezframe/column_type.rb', line 699 def form(opts = {}) return nil if no_edit? && !opts[:force] h = super return nil unless h h[:item] = @pref_h return h end |
#view(opts = {}) ⇒ Object
707 708 709 710 |
# File 'lib/ezframe/column_type.rb', line 707 def view(opts = {}) return nil if no_view? && !opts[:force] return @pref_h[@value.to_i] end |