【发布时间】:2014-02-09 18:50:33
【问题描述】:
创建班次时出现此错误...
ActiveRecord::MultiparameterAssignmentErrors (2 error(s) on assignment of multiparameter attributes [error on assignment [8, 0, 1970, 1, 1] to inizio (undefined method `Europe/Rome' for Time:Class),error on assignment [16, 0, 1970, 1, 1] to fine (undefined method `Europe/Rome' for Time:Class)]):
app/controllers/shifts_controller.rb:43:in `create'
在 application.rb 我有
config.time_zone = 'Europe/Rome'
config.active_record.default_timezone = 'Europe/Rome'
模型是
class Shift < ActiveRecord::Base
after_initialize do
self.stato ||= true
self.inizio ||= Time.zone.now
self.fine ||= Time.zone.now
end
end
【问题讨论】:
-
stackoverflow.com/questions/6118779/… 的副本或尝试“Rome”而不是“Europe/Rome”。
-
你的应用上传到 Github 上了吗?
标签: ruby time ruby-on-rails-4 timezone