rails:2051
From: Kazuhiro Yoshida <moriq@m...>
Date: Thu, 01 Mar 2007 08:23:19 +0900
Subject: [rails:2051] Re: コード値の表示時の変換方式
moriqです。 YOKOYAMA, Hideyuki wrote: > なんらかの方法で上記の > genre.to_desc > は定義可能なんでしょうか? compose_ofでできると思います。 class Music < ActiveRecord::Base compose_of :genre end class Genre GENRES = { 1 => "邦楽", 2 => "洋楽", 3 => "クラシック", 4 => "その他" }.freeze def initialize(id) @id = id end def genre @id end def to_desc GENRES[@id] end end -- ML: rails@r... 使い方: http://QuickML.com/
2041 2007-02-28 05:47 [hisano@s... ] 多段のlayoutの作成方法 2042 2007-02-28 08:03 ┗[moriq@m... ] 2043 2007-02-28 09:01 ┗[hisano@s... ] 2044 2007-02-28 17:50 ┗[yokoyama@c... ] コード値の表示時の変換方式 2045 2007-02-28 18:09 ┣[shachi@j... ] 2046 2007-02-28 19:06 ┗[utsumi@t... ] 2047 2007-02-28 22:35 ┗[yokoyama@c... ] 2048 2007-02-28 23:52 ┣[utsumi@t... ] 2049 2007-03-01 00:15 ┃┣[utsumi@t... ] 2052 2007-03-01 00:24 ┃┃┗[yokoyama@c... ] 2050 2007-03-01 00:19 ┃┗[yokoyama@c... ] -> 2051 2007-03-01 00:23 ┗[moriq@m... ] 2053 2007-03-01 00:30 ┣[moriq@m... ] 2055 2007-03-01 16:51 ┗[yokoyama@c... ] 2056 2007-03-01 18:59 ┗[moriq@m... ]