質問編集履歴
2
追記編集
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,7 +14,46 @@
|
|
14
14
|
```
|
15
15
|
undefined method `update' for nil:NilClass
|
16
16
|
```
|
17
|
+
追記:
|
18
|
+
id:12のデータを投稿後に編集するようにしたいので
|
19
|
+
コメントいただいたようにデータが入っていないのかな?と見たところ
|
17
20
|
|
21
|
+
```
|
22
|
+
2.6.0 :004 > Article.find(12)
|
23
|
+
Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
|
24
|
+
=> #<Article id: 12, title: "testing article", description: "this is a test", created_at: "2019-06-21 19:13:10", updated_at: "2019-06-21 19:13:10">
|
25
|
+
2.6.0 :005 >
|
26
|
+
```
|
27
|
+
となっており、データ自体は存在するようです。
|
28
|
+
|
29
|
+
development.logのエラーが出ているところのログです。
|
30
|
+
```
|
31
|
+
app/controllers/articles_controller.rb:23:in `update'
|
32
|
+
[1m[36mArticle Load (0.4ms)[0m [1m[34mSELECT "articles".* FROM "articles" LIMIT ?[0m [["LIMIT", 11]]
|
33
|
+
[1m[36mArticle Load (0.2ms)[0m [1m[34mSELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ?[0m [["id", 12], ["LIMIT", 1]]
|
34
|
+
Started GET "/articles/12/edit" for 39.111.211.9 at 2019-06-22 05:22:48 +0000
|
35
|
+
Cannot render console from 39.111.211.9! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
36
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
37
|
+
↳ /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
|
38
|
+
Processing by ArticlesController#edit as HTML
|
39
|
+
Parameters: {"id"=>"12"}
|
40
|
+
[1m[36mArticle Load (0.1ms)[0m [1m[34mSELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ?[0m [["id", 12], ["LIMIT", 1]]
|
41
|
+
↳ app/controllers/articles_controller.rb:7
|
42
|
+
Rendering articles/edit.html.erb within layouts/application
|
43
|
+
Rendered articles/edit.html.erb within layouts/application (4.7ms)
|
44
|
+
Completed 200 OK in 215ms (Views: 200.8ms | ActiveRecord: 0.7ms)
|
45
|
+
|
46
|
+
|
47
|
+
Started PATCH "/articles/12" for 39.111.211.9 at 2019-06-22 05:22:56 +0000
|
48
|
+
Cannot render console from 39.111.211.9! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
49
|
+
Processing by ArticlesController#update as HTML
|
50
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"RvxoB0HoLqxeKxzzVF0q3RnSwQ2Gt6NQGXQ2v3JArvL0SmVMx95vddWBXKBndq0nKbBE7W8lp+M5ryxJIZvWLg==", "article"=>{"title"=>"testing article", "description"=>"this is a test edited"}, "commit"=>"Update Article", "id"=>"12"}
|
51
|
+
[1m[36mArticle Load (0.1ms)[0m [1m[34mSELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ?[0m [["id", 12], ["LIMIT", 1]]
|
52
|
+
↳ app/controllers/articles_controller.rb:22
|
53
|
+
Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.1ms)
|
54
|
+
```
|
55
|
+
|
56
|
+
|
18
57
|
### 該当のソースコード
|
19
58
|
github:
|
20
59
|
https://github.com/yuks0810/alpha-blog
|
1
エラー内容について
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
```
|
66
66
|
|
67
|
-
|
67
|
+
undefined methodとなっていますが、def updateで定義していてタイポでもないと思うので
|
68
|
-
|
68
|
+
なぜエラーが出るのかわかりません。
|
69
69
|
|
70
70
|
どなたかわかる方いらっしゃいましたらご教示お願い致します。
|