简体   繁体   中英

How to configure the time zone in rails

I'm trying to configure the date-zone in my rails app, i want that when insert a new record in any table, that the timestamps columns (created_at and updated_at), be saved in my time zone (in my case Bogotá).

I'm writing this in my application.rb file:

config.time_zone = 'Bogota'
config.active_record.default_timezone = 'Bogota'

I'm trying the following too:

config.time_zone = 'Bogota'
config.active_record.default_timezone = :local'

But it doesn't seems to work

Can someone help me to resolve this issue.

 config.time_zone = 'Bogota' 
 config.active_record.default_timezone = :local 

is the correct code, in application.rb. Make sure you reboot the server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM