質問編集履歴

2

追記編集

2019/06/22 05:34

投稿

YukiNakata
YukiNakata

スコア20

test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,84 @@
30
30
 
31
31
  ```
32
32
 
33
+ 追記:
34
+
35
+ id:12のデータを投稿後に編集するようにしたいので
36
+
37
+ コメントいただいたようにデータが入っていないのかな?と見たところ
38
+
39
+
40
+
41
+ ```
42
+
43
+ 2.6.0 :004 > Article.find(12)
44
+
45
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
46
+
47
+ => #<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">
48
+
49
+ 2.6.0 :005 >
50
+
51
+ ```
52
+
53
+ となっており、データ自体は存在するようです。
54
+
55
+
56
+
57
+ development.logのエラーが出ているところのログです。
58
+
59
+ ```
60
+
61
+ app/controllers/articles_controller.rb:23:in `update'
62
+
63
+ Article Load (0.4ms) SELECT "articles".* FROM "articles" LIMIT ? [["LIMIT", 11]]
64
+
65
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
66
+
67
+ Started GET "/articles/12/edit" for 39.111.211.9 at 2019-06-22 05:22:48 +0000
68
+
69
+ Cannot render console from 39.111.211.9! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
70
+
71
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
72
+
73
+ ↳ /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
74
+
75
+ Processing by ArticlesController#edit as HTML
76
+
77
+ Parameters: {"id"=>"12"}
78
+
79
+ Article Load (0.1ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
80
+
81
+ ↳ app/controllers/articles_controller.rb:7
82
+
83
+ Rendering articles/edit.html.erb within layouts/application
84
+
85
+ Rendered articles/edit.html.erb within layouts/application (4.7ms)
86
+
87
+ Completed 200 OK in 215ms (Views: 200.8ms | ActiveRecord: 0.7ms)
88
+
89
+
90
+
91
+
92
+
93
+ Started PATCH "/articles/12" for 39.111.211.9 at 2019-06-22 05:22:56 +0000
94
+
95
+ Cannot render console from 39.111.211.9! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
96
+
97
+ Processing by ArticlesController#update as HTML
98
+
99
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"RvxoB0HoLqxeKxzzVF0q3RnSwQ2Gt6NQGXQ2v3JArvL0SmVMx95vddWBXKBndq0nKbBE7W8lp+M5ryxJIZvWLg==", "article"=>{"title"=>"testing article", "description"=>"this is a test edited"}, "commit"=>"Update Article", "id"=>"12"}
100
+
101
+ Article Load (0.1ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
102
+
103
+ ↳ app/controllers/articles_controller.rb:22
104
+
105
+ Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.1ms)
106
+
107
+ ```
108
+
109
+
110
+
33
111
 
34
112
 
35
113
  ### 該当のソースコード

1

エラー内容について

2019/06/22 05:33

投稿

YukiNakata
YukiNakata

スコア20

test CHANGED
File without changes
test CHANGED
@@ -130,9 +130,9 @@
130
130
 
131
131
 
132
132
 
133
- エラーの内容もあまりよくわかっていないので
133
+ undefined methodとなっていますが、def updateで定義していてタイポでもないと思うので
134
134
 
135
- 単純ミスであればすみません。
135
+ ぜエラーが出るのかわかりません。
136
136
 
137
137
 
138
138