How can i prefill datetime_select with times in custom time zone?

人走茶凉 提交于 2019-12-01 08:47:39

As pixeltrix pointed out in the thread of the bug report, it's cleaner to override the readers/getters of the attributes in question like so:

# in event model

def beginn
  super.in_time_zone(time_zone) if super
end

def endd
    super.in_time_zone(time_zone) if super
end

This way the logic in the edit action as outlined in the question can be omitted and interferences with other parts that rely on Time.zone are avoided.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!