subject = Subject.new(name:"First Subject", position: 1, visible: true)
irb(main):008:0* subject.save
(0.2ms) BEGIN
SQL (2.8ms) INSERT INTO `subjects` (`name`, `position`, `visible`, `created_at`, `updated_at`) VALUES ('First Subject', 1, 1, '2016-04-16 01:52:31', '2016-04-16 01:52:31')
(1.5ms) COMMIT
irb(main):008:0* subject
=> #<Subject id: 1, name: "First Subject", position: 1, visible: true, created_at: "2016-04-16 01:52:31", updated_at: "2016-04-16 01:52:31">
本来是在10点左右保存的,但是里面的created_at, updated_at时间是1点,不和系统时间一致。
config/application.rb
Saya belum begitu faham lagi, sila rujuk https://ruby-china.org/topics/16187
Zon waktu manakah itu? Tambah 8 jam dan lihat pukul berapa sekarang
irb>Masa.sekarang
=> 2016-05-12 15:30:14 +0800
Begitukah
Kerana anda berada di GMT+8. Secara amnya, masa GMT disimpan dalam AR.