質問編集履歴
2
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
railsにおいて、created_atの時間
|
1
|
+
railsにおいて、created_atの時間を正しく保存する
|
test
CHANGED
File without changes
|
1
コマンドのソースコード加えてみました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,9 +34,19 @@
|
|
34
34
|
|
35
35
|
ソースコード
|
36
36
|
|
37
|
+
C:\Users\nakan_n24xdns\tweetbook>rails console
|
38
|
+
|
39
|
+
Loading development environment (Rails 5.2.4.2)
|
40
|
+
|
41
|
+
irb(main):001:0> post = Post.find_by(id: 2) Post Load (1.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]]
|
42
|
+
|
43
|
+
=> #<Post id: 2, content: "Nice to meet you", created_at: "2020-04-19 20:44:29", updated_at: "2020-04-19 20:44:29">
|
44
|
+
|
45
|
+
irb(main):002:0> post.created_at => Mon, 20 Apr 2020 05:44:29 JST +09:00
|
46
|
+
|
37
47
|
```
|
38
48
|
|
39
|
-
|
49
|
+
|
40
50
|
|
41
51
|
### 試したこと
|
42
52
|
|