rails:2312
From: "久野@サイベイト(株) " <hisano@s...>
Date: Fri, 03 Aug 2007 16:13:58 +0900
Subject: [rails:2312] Re: 動的プログラミング?
久野と申します。
年数分の繰り返しが気になるので、
以下のように変えてみました。
# 未検証です。
first_year = 1999
last_year = 2007
uketsuke_motos = Table1.find(:all)
for uketsuke_moto in uketsuke_motos
(first_year..last_year).each do |year|
uketsuke_moto_bango = uketsuke_moto.send("uke#{year}")
if uketsuke_moto_bango != 0 then
uketsuke = Table2.new(
:kigyo_bango => uketsuke_moto.kigyo_bango,
:uketsuke_nen => year,
:uketsuke_bango =uketsuke_moto_bango)
uketsuke.save
end
end
end
--
ML: rails@r...
使い方: http://QuickML.com/
2307 2007-08-03 06:26 [s-kuri@s... ] 参加します 2309 2007-08-03 08:06 ┗[ohshima@p... ] 動的プログラミング? 2310 2007-08-03 08:24 ┣[snoozer.05@g... ] 2311 2007-08-03 09:04 ┃┗[ohshima@p... ] -> 2312 2007-08-03 09:13 ┗[hisano@s... ] 2313 2007-08-03 09:45 ┗[ohshima@p... ] 2314 2007-08-03 09:53 ┣[snoozer.05@g... ] 2315 2007-08-03 10:03 ┃┗[ohshima@p... ] 2316 2007-08-03 12:48 ┗[sakuro@e... ] 2317 2007-08-03 14:16 ┗[ohshima@p... ]