要翻桌了...
updated 2010-01-08 01:32 最後用 to_f 解決。
updated 2010-01-07 19:06 這更扯
>> Vip.first.created_at.class
=> ActiveSupport::TimeWithZone
>> Vip.first.expired_at.class
=> ActiveSupport::TimeWithZone
一樣的 class 喔,但是實際上不同:
>> Vip.first.created_at.to_i
=> 1252402216
>> Vip.first.expired_at.to_i
NoMethodError: undefined method `to_i' for DateTime
* * *
>> Vip.first.expired_at.to_i
NoMethodError: undefined method `to_i' for DateTime
>> Vip.first.expired_at.to_time.to_i
NoMethodError: undefined method `to_i' for DateTime
rails 都亂改 core method... to_time 騙人!
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.