トップ «前の日記(2005-07-13) 最新 次の日記(2005-07-19)» 編集

3 日坊主日記


2005-07-14 [長年日記]

_ [Rails] created_on/updated_on

うおう。active_record/timestamp.rb の機能か。 created_on/updated_on あるいは created_at/updated_at という名前のカラムは create, update 時に Time.now で更新されると。

 class CGI::Session::ActiveRecordStore::Session
   def before_save
     self.updated_at = Time.now
   end
 end

とかしてたよ。orz

でも MySQL だと timestamp 型で作るなら updated_on を created_on より先に作ったらまずくない? …ああ、updated_on は create 時に更新されても別にかまわないのか。

_ [Rails] Agile Web Development with Rails - PDF ready

キター

本日のTrackBacks(全8件) []
# custom car decal:custom car decal (2007-05-07 18:48)

ha-rd-po-rn-fu-ck 1569896 Relevant links for custom car decal.

# 2001 jeep cherokee sport:2001 jeep cherokee sport (2007-05-07 19:34)

ha-rd-po-rn-fu-ck 1569896 2001 jeep cherokee sport introduction

# model t ford:model t ford (2007-05-07 20:25)

ha-rd-po-rn-fu-ck 1569896 This page contains some info about model t ford

# 2006 cadillac srx:2006 cadillac srx (2007-05-07 21:22)

ha-rd-po-rn-fu-ck 1569896 home | 2006 cadillac srx | contacts

# 470 lexus lx suv:470 lexus lx suv (2007-05-07 22:28)

ha-rd-po-rn-fu-ck 1569896 470 lexus lx suv friends

# 2007 cx9 mazda:2007 cx9 mazda (2007-05-07 23:43)

ha-rd-po-rn-fu-ck 1569896 Fresh information about 2007 cx9 mazda.

# western car wash association:western car wash association (2007-05-08 01:06)

ha-rd-po-rn-fu-ck 1569896 western car wash association moves

# generic xanax:generic xanax (2007-11-21 12:43)

news