質問編集履歴
8
markdown記法
test
CHANGED
File without changes
|
test
CHANGED
@@ -156,7 +156,7 @@
|
|
156
156
|
|
157
157
|
root設定を削除した状態でサーバーを立ち上げたところ、こんな画面が出てきました。
|
158
158
|
|
159
|
-
|
159
|
+
```lang-html
|
160
160
|
|
161
161
|
<html>
|
162
162
|
|
@@ -226,6 +226,12 @@
|
|
226
226
|
|
227
227
|
|
228
228
|
|
229
|
+
```
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
229
235
|
|
230
236
|
|
231
237
|
|
7
markdown記法
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
+
```lang-ruby
|
24
|
+
|
23
25
|
routes.rb
|
24
26
|
|
25
27
|
|
@@ -76,9 +78,11 @@
|
|
76
78
|
|
77
79
|
end
|
78
80
|
|
79
|
-
|
81
|
+
```
|
82
|
+
|
83
|
+
|
84
|
+
|
80
|
-
|
85
|
+
```lang-ruby
|
81
|
-
|
82
86
|
|
83
87
|
home_controller.rb
|
84
88
|
|
@@ -102,6 +106,8 @@
|
|
102
106
|
|
103
107
|
end
|
104
108
|
|
109
|
+
```
|
110
|
+
|
105
111
|
|
106
112
|
|
107
113
|
************
|
6
エラーの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -144,6 +144,84 @@
|
|
144
144
|
|
145
145
|
|
146
146
|
|
147
|
+
*************
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
root設定を削除した状態でサーバーを立ち上げたところ、こんな画面が出てきました。
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<html>
|
156
|
+
|
157
|
+
<head>
|
158
|
+
|
159
|
+
<meta charset='utf-8'>
|
160
|
+
|
161
|
+
<title>Error 502 - Bad Gateway</title>
|
162
|
+
|
163
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.c9.io/errors/style.css" />
|
164
|
+
|
165
|
+
<style type="text/css">
|
166
|
+
|
167
|
+
.error_content {
|
168
|
+
|
169
|
+
background: rgba(255, 255, 255, 0.23);
|
170
|
+
|
171
|
+
padding: 10px;
|
172
|
+
|
173
|
+
width: 641px;
|
174
|
+
|
175
|
+
margin: 25px 0;
|
176
|
+
|
177
|
+
display: none;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
#error-msg {
|
184
|
+
|
185
|
+
display: block;
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
</style>
|
190
|
+
|
191
|
+
</head>
|
192
|
+
|
193
|
+
<body class="errorUnknown light">
|
194
|
+
|
195
|
+
<div id="wrapper">
|
196
|
+
|
197
|
+
<h1>Error 502 - Bad Gateway</h1>
|
198
|
+
|
199
|
+
<div class="error_content" id="error-msg">
|
200
|
+
|
201
|
+
<p>Please click <a href="javascript:location.reload(true)">here</a> to try again, if the issue persists please contact <a href="https://c9.io/support">support</a></p>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<a href="http://status.c9.io">Status Page</a> |
|
208
|
+
|
209
|
+
<a href="https://c9.io/support">Support</a> |
|
210
|
+
|
211
|
+
<a href="https://c9.io/dashboard.html">Dashboard</a> |
|
212
|
+
|
213
|
+
<a href="https://c9.io">Home</a>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
</body>
|
218
|
+
|
219
|
+
</html>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
147
225
|
|
148
226
|
|
149
227
|
|
5
ログを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -128,6 +128,20 @@
|
|
128
128
|
|
129
129
|
|
130
130
|
|
131
|
+
その際のログはこちらです。
|
132
|
+
|
133
|
+
Started GET "/" for 58.146.3.66 at 2017-11-01 02:53:23 +0000
|
134
|
+
|
135
|
+
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
136
|
+
|
137
|
+
Processing by HomeController#top as HTML
|
138
|
+
|
139
|
+
Rendering home/top.html.erb within layouts/application
|
140
|
+
|
141
|
+
Rendered home/top.html.erb within layouts/application (0.5ms)
|
142
|
+
|
143
|
+
Completed 500 Internal Server Error in 5ms
|
144
|
+
|
131
145
|
|
132
146
|
|
133
147
|
|
4
発生しえいる問題に追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -104,6 +104,28 @@
|
|
104
104
|
|
105
105
|
|
106
106
|
|
107
|
+
************
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
routes.rbにroot設定を追加してみました。
|
112
|
+
|
113
|
+
..中略..
|
114
|
+
|
115
|
+
get '/top(.:format)' => "home#top"
|
116
|
+
|
117
|
+
get '/about(.:format)' => "home#about"
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
root to: 'home#top'
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
サーバーを立ち上げると、即座にWe're sorry, but something went wrongという画面に。
|
128
|
+
|
107
129
|
|
108
130
|
|
109
131
|
|
@@ -114,7 +136,7 @@
|
|
114
136
|
|
115
137
|
###試したこと
|
116
138
|
|
117
|
-
|
139
|
+
|
118
140
|
|
119
141
|
|
120
142
|
|
3
質問がわかりにくかったので、整理しました。初心者ですが、よろしくお願いします。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Cloud9でRuby on railsにコードを書いているのですが、
|
1
|
+
Cloud9でRuby on railsにコードを書いているのですが、 ルーティングエラーが出ます。どこがエラーなのでしょうか?
|
test
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
###前提・実現したいこと
|
2
|
-
|
3
|
-
ここに質問したいことを詳細に書いてください
|
4
2
|
|
5
3
|
|
6
4
|
|
@@ -12,65 +10,13 @@
|
|
12
10
|
|
13
11
|
「Yay!You're on Rails」という画面になってしまいます。
|
14
12
|
|
15
|
-
エラー
|
13
|
+
TOPページのURLに飛ぶと、ルーティングエラーが出ます。
|
16
14
|
|
17
15
|
何が原因でしょうか?
|
18
16
|
|
19
17
|
|
20
18
|
|
21
19
|
###発生している問題・エラーメッセージ
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
エラーメッセージ
|
28
|
-
|
29
|
-
```
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
###該当のソースコード
|
34
|
-
|
35
|
-
railsサーバを立ち上げたとき、下記のように出てきます。
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
$ rails s -p $PORT -b $IP
|
40
|
-
|
41
|
-
=> Booting Puma
|
42
|
-
|
43
|
-
=> Rails 5.1.4 application starting in development
|
44
|
-
|
45
|
-
=> Run `rails server -h` for more startup options
|
46
|
-
|
47
|
-
Puma starting in single mode...
|
48
|
-
|
49
|
-
* Version 3.10.0 (ruby 2.4.0-p0), codename: Russell's Teapot
|
50
|
-
|
51
|
-
* Min threads: 5, max threads: 5
|
52
|
-
|
53
|
-
* Environment: development
|
54
|
-
|
55
|
-
* Listening on tcp://0.0.0.0:8080
|
56
|
-
|
57
|
-
Use Ctrl-C to stop
|
58
|
-
|
59
|
-
Started GET "/" for 58.146.3.66 at 2017-10-27 15:49:31 +0000
|
60
|
-
|
61
|
-
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
62
|
-
|
63
|
-
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
|
64
|
-
|
65
|
-
Processing by Rails::WelcomeController#index as HTML
|
66
|
-
|
67
|
-
Rendering /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb
|
68
|
-
|
69
|
-
Rendered /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb (3.2ms)
|
70
|
-
|
71
|
-
Completed 200 OK in 18ms (Views: 8.4ms | ActiveRecord: 0.0ms)
|
72
|
-
|
73
|
-
|
74
20
|
|
75
21
|
|
76
22
|
|
@@ -128,7 +74,31 @@
|
|
128
74
|
|
129
75
|
|
130
76
|
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
home_controller.rb
|
84
|
+
|
85
|
+
|
86
|
+
|
131
|
-
|
87
|
+
class HomeController < ApplicationController
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
def top
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
def about
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
|
132
102
|
|
133
103
|
end
|
134
104
|
|
@@ -136,9 +106,15 @@
|
|
136
106
|
|
137
107
|
|
138
108
|
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
139
115
|
###試したこと
|
140
116
|
|
141
|
-
|
117
|
+
getをrootにしたりなど、またresourcesを書いたりしましたが一向に動じません。
|
142
118
|
|
143
119
|
|
144
120
|
|
2
routes.rbを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -74,6 +74,66 @@
|
|
74
74
|
|
75
75
|
|
76
76
|
|
77
|
+
routes.rb
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
Rails.application.routes.draw do
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
get 'login(.:format)' => "users#login_form"
|
86
|
+
|
87
|
+
post 'login(.:format)' => "users#login"
|
88
|
+
|
89
|
+
post 'logout(.:format)' => "users#logout"
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
post 'users/:id/update(.:format)' => "users#update"
|
94
|
+
|
95
|
+
get 'users/:id/edit(.:format)' => "users#edit"
|
96
|
+
|
97
|
+
post '/users/create(.:format)' => "users#create"
|
98
|
+
|
99
|
+
get '/signup(.:format)' => "users#new"
|
100
|
+
|
101
|
+
get '/users/index(.:format)' => "users#index"
|
102
|
+
|
103
|
+
get '/users/:id(.:format)' => "users#show"
|
104
|
+
|
105
|
+
post '/users/:id/destroy(.:format)' => "users#destroy"
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
get '/posts/index(.:format)' => "posts#index"
|
110
|
+
|
111
|
+
get '/posts/new(.:format)' => "posts#new"
|
112
|
+
|
113
|
+
get '/posts/:id(.:format)' => "posts#show"
|
114
|
+
|
115
|
+
post '/posts/create(.:format)' => "posts#create"
|
116
|
+
|
117
|
+
get '/posts/:id/edit(.:format)' => "posts#edit"
|
118
|
+
|
119
|
+
post '/posts/:id/update(.:format)' => "posts#update"
|
120
|
+
|
121
|
+
post '/posts/:id/destroy(.:format)' => "posts#destroy"
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
get '/top(.:format)' => "home#top"
|
126
|
+
|
127
|
+
get '/about(.:format)' => "home#about"
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
|
77
137
|
|
78
138
|
|
79
139
|
###試したこと
|
1
ソースコードを記入しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,11 +32,47 @@
|
|
32
32
|
|
33
33
|
###該当のソースコード
|
34
34
|
|
35
|
-
|
35
|
+
railsサーバを立ち上げたとき、下記のように出てきます。
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
$ rails s -p $PORT -b $IP
|
40
|
+
|
39
|
-
|
41
|
+
=> Booting Puma
|
42
|
+
|
43
|
+
=> Rails 5.1.4 application starting in development
|
44
|
+
|
45
|
+
=> Run `rails server -h` for more startup options
|
46
|
+
|
47
|
+
Puma starting in single mode...
|
48
|
+
|
49
|
+
* Version 3.10.0 (ruby 2.4.0-p0), codename: Russell's Teapot
|
50
|
+
|
51
|
+
* Min threads: 5, max threads: 5
|
52
|
+
|
53
|
+
* Environment: development
|
54
|
+
|
55
|
+
* Listening on tcp://0.0.0.0:8080
|
56
|
+
|
57
|
+
Use Ctrl-C to stop
|
58
|
+
|
59
|
+
Started GET "/" for 58.146.3.66 at 2017-10-27 15:49:31 +0000
|
60
|
+
|
61
|
+
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
62
|
+
|
63
|
+
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
|
64
|
+
|
65
|
+
Processing by Rails::WelcomeController#index as HTML
|
66
|
+
|
67
|
+
Rendering /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb
|
68
|
+
|
69
|
+
Rendered /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb (3.2ms)
|
70
|
+
|
71
|
+
Completed 200 OK in 18ms (Views: 8.4ms | ActiveRecord: 0.0ms)
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
40
76
|
|
41
77
|
|
42
78
|
|