質問編集履歴
8
markdown記法
title
CHANGED
File without changes
|
body
CHANGED
@@ -77,7 +77,7 @@
|
|
77
77
|
*************
|
78
78
|
|
79
79
|
root設定を削除した状態でサーバーを立ち上げたところ、こんな画面が出てきました。
|
80
|
-
|
80
|
+
```lang-html
|
81
81
|
<html>
|
82
82
|
<head>
|
83
83
|
<meta charset='utf-8'>
|
@@ -112,9 +112,12 @@
|
|
112
112
|
</body>
|
113
113
|
</html>
|
114
114
|
|
115
|
+
```
|
115
116
|
|
116
117
|
|
117
118
|
|
119
|
+
|
120
|
+
|
118
121
|
###試したこと
|
119
122
|
|
120
123
|
|
7
markdown記法
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
###発生している問題・エラーメッセージ
|
11
11
|
|
12
|
+
```lang-ruby
|
12
13
|
routes.rb
|
13
14
|
|
14
15
|
Rails.application.routes.draw do
|
@@ -37,8 +38,9 @@
|
|
37
38
|
get '/about(.:format)' => "home#about"
|
38
39
|
|
39
40
|
end
|
41
|
+
```
|
40
42
|
|
41
|
-
|
43
|
+
```lang-ruby
|
42
44
|
home_controller.rb
|
43
45
|
|
44
46
|
class HomeController < ApplicationController
|
@@ -50,6 +52,7 @@
|
|
50
52
|
end
|
51
53
|
|
52
54
|
end
|
55
|
+
```
|
53
56
|
|
54
57
|
************
|
55
58
|
|
6
エラーの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -71,8 +71,47 @@
|
|
71
71
|
Rendered home/top.html.erb within layouts/application (0.5ms)
|
72
72
|
Completed 500 Internal Server Error in 5ms
|
73
73
|
|
74
|
+
*************
|
74
75
|
|
76
|
+
root設定を削除した状態でサーバーを立ち上げたところ、こんな画面が出てきました。
|
75
77
|
|
78
|
+
<html>
|
79
|
+
<head>
|
80
|
+
<meta charset='utf-8'>
|
81
|
+
<title>Error 502 - Bad Gateway</title>
|
82
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.c9.io/errors/style.css" />
|
83
|
+
<style type="text/css">
|
84
|
+
.error_content {
|
85
|
+
background: rgba(255, 255, 255, 0.23);
|
86
|
+
padding: 10px;
|
87
|
+
width: 641px;
|
88
|
+
margin: 25px 0;
|
89
|
+
display: none;
|
90
|
+
}
|
91
|
+
|
92
|
+
#error-msg {
|
93
|
+
display: block;
|
94
|
+
}
|
95
|
+
</style>
|
96
|
+
</head>
|
97
|
+
<body class="errorUnknown light">
|
98
|
+
<div id="wrapper">
|
99
|
+
<h1>Error 502 - Bad Gateway</h1>
|
100
|
+
<div class="error_content" id="error-msg">
|
101
|
+
<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>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<a href="http://status.c9.io">Status Page</a> |
|
105
|
+
<a href="https://c9.io/support">Support</a> |
|
106
|
+
<a href="https://c9.io/dashboard.html">Dashboard</a> |
|
107
|
+
<a href="https://c9.io">Home</a>
|
108
|
+
</div>
|
109
|
+
</body>
|
110
|
+
</html>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
76
115
|
###試したこと
|
77
116
|
|
78
117
|
|
5
ログを追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -63,6 +63,13 @@
|
|
63
63
|
|
64
64
|
サーバーを立ち上げると、即座にWe're sorry, but something went wrongという画面に。
|
65
65
|
|
66
|
+
その際のログはこちらです。
|
67
|
+
Started GET "/" for 58.146.3.66 at 2017-11-01 02:53:23 +0000
|
68
|
+
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
69
|
+
Processing by HomeController#top as HTML
|
70
|
+
Rendering home/top.html.erb within layouts/application
|
71
|
+
Rendered home/top.html.erb within layouts/application (0.5ms)
|
72
|
+
Completed 500 Internal Server Error in 5ms
|
66
73
|
|
67
74
|
|
68
75
|
|
4
発生しえいる問題に追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,13 +51,24 @@
|
|
51
51
|
|
52
52
|
end
|
53
53
|
|
54
|
+
************
|
54
55
|
|
56
|
+
routes.rbにroot設定を追加してみました。
|
57
|
+
..中略..
|
58
|
+
get '/top(.:format)' => "home#top"
|
59
|
+
get '/about(.:format)' => "home#about"
|
60
|
+
|
61
|
+
root to: 'home#top'
|
62
|
+
end
|
55
63
|
|
64
|
+
サーバーを立ち上げると、即座にWe're sorry, but something went wrongという画面に。
|
56
65
|
|
57
66
|
|
67
|
+
|
68
|
+
|
58
69
|
###試したこと
|
59
|
-
getをrootにしたりなど、またresourcesを書いたりしましたが一向に動じません。
|
60
70
|
|
71
|
+
|
61
72
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
62
73
|
Rails version: 5.1.4
|
63
74
|
Ruby version: 2.4.0
|
3
質問がわかりにくかったので、整理しました。初心者ですが、よろしくお願いします。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Cloud9でRuby on railsにコードを書いているのですが、
|
1
|
+
Cloud9でRuby on railsにコードを書いているのですが、 ルーティングエラーが出ます。どこがエラーなのでしょうか?
|
body
CHANGED
@@ -1,41 +1,14 @@
|
|
1
1
|
###前提・実現したいこと
|
2
|
-
ここに質問したいことを詳細に書いてください
|
3
2
|
|
4
3
|
Cloud9でRuby on railsにコードを書いているのですが、
|
5
4
|
サーバーを立ち上げたら、突然機能しなくなりました。
|
6
5
|
その前までは正しくサーバーが機能していたのですが、
|
7
6
|
「Yay!You're on Rails」という画面になってしまいます。
|
8
|
-
エラー
|
7
|
+
TOPページのURLに飛ぶと、ルーティングエラーが出ます。
|
9
8
|
何が原因でしょうか?
|
10
9
|
|
11
10
|
###発生している問題・エラーメッセージ
|
12
11
|
|
13
|
-
```
|
14
|
-
エラーメッセージ
|
15
|
-
```
|
16
|
-
|
17
|
-
###該当のソースコード
|
18
|
-
railsサーバを立ち上げたとき、下記のように出てきます。
|
19
|
-
|
20
|
-
$ rails s -p $PORT -b $IP
|
21
|
-
=> Booting Puma
|
22
|
-
=> Rails 5.1.4 application starting in development
|
23
|
-
=> Run `rails server -h` for more startup options
|
24
|
-
Puma starting in single mode...
|
25
|
-
* Version 3.10.0 (ruby 2.4.0-p0), codename: Russell's Teapot
|
26
|
-
* Min threads: 5, max threads: 5
|
27
|
-
* Environment: development
|
28
|
-
* Listening on tcp://0.0.0.0:8080
|
29
|
-
Use Ctrl-C to stop
|
30
|
-
Started GET "/" for 58.146.3.66 at 2017-10-27 15:49:31 +0000
|
31
|
-
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
32
|
-
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
|
33
|
-
Processing by Rails::WelcomeController#index as HTML
|
34
|
-
Rendering /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb
|
35
|
-
Rendered /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb (3.2ms)
|
36
|
-
Completed 200 OK in 18ms (Views: 8.4ms | ActiveRecord: 0.0ms)
|
37
|
-
|
38
|
-
|
39
12
|
routes.rb
|
40
13
|
|
41
14
|
Rails.application.routes.draw do
|
@@ -63,12 +36,27 @@
|
|
63
36
|
get '/top(.:format)' => "home#top"
|
64
37
|
get '/about(.:format)' => "home#about"
|
65
38
|
|
66
|
-
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
67
39
|
end
|
68
40
|
|
69
41
|
|
42
|
+
home_controller.rb
|
43
|
+
|
44
|
+
class HomeController < ApplicationController
|
45
|
+
|
46
|
+
def top
|
47
|
+
end
|
48
|
+
|
49
|
+
def about
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
70
58
|
###試したこと
|
71
|
-
|
59
|
+
getをrootにしたりなど、またresourcesを書いたりしましたが一向に動じません。
|
72
60
|
|
73
61
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
74
62
|
Rails version: 5.1.4
|
2
routes.rbを追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,7 +36,37 @@
|
|
36
36
|
Completed 200 OK in 18ms (Views: 8.4ms | ActiveRecord: 0.0ms)
|
37
37
|
|
38
38
|
|
39
|
+
routes.rb
|
39
40
|
|
41
|
+
Rails.application.routes.draw do
|
42
|
+
|
43
|
+
get 'login(.:format)' => "users#login_form"
|
44
|
+
post 'login(.:format)' => "users#login"
|
45
|
+
post 'logout(.:format)' => "users#logout"
|
46
|
+
|
47
|
+
post 'users/:id/update(.:format)' => "users#update"
|
48
|
+
get 'users/:id/edit(.:format)' => "users#edit"
|
49
|
+
post '/users/create(.:format)' => "users#create"
|
50
|
+
get '/signup(.:format)' => "users#new"
|
51
|
+
get '/users/index(.:format)' => "users#index"
|
52
|
+
get '/users/:id(.:format)' => "users#show"
|
53
|
+
post '/users/:id/destroy(.:format)' => "users#destroy"
|
54
|
+
|
55
|
+
get '/posts/index(.:format)' => "posts#index"
|
56
|
+
get '/posts/new(.:format)' => "posts#new"
|
57
|
+
get '/posts/:id(.:format)' => "posts#show"
|
58
|
+
post '/posts/create(.:format)' => "posts#create"
|
59
|
+
get '/posts/:id/edit(.:format)' => "posts#edit"
|
60
|
+
post '/posts/:id/update(.:format)' => "posts#update"
|
61
|
+
post '/posts/:id/destroy(.:format)' => "posts#destroy"
|
62
|
+
|
63
|
+
get '/top(.:format)' => "home#top"
|
64
|
+
get '/about(.:format)' => "home#about"
|
65
|
+
|
66
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
67
|
+
end
|
68
|
+
|
69
|
+
|
40
70
|
###試したこと
|
41
71
|
課題に対してアプローチしたことを記載してください
|
42
72
|
|
1
ソースコードを記入しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,10 +15,28 @@
|
|
15
15
|
```
|
16
16
|
|
17
17
|
###該当のソースコード
|
18
|
-
|
18
|
+
railsサーバを立ち上げたとき、下記のように出てきます。
|
19
19
|
|
20
|
+
$ rails s -p $PORT -b $IP
|
20
|
-
|
21
|
+
=> Booting Puma
|
22
|
+
=> Rails 5.1.4 application starting in development
|
23
|
+
=> Run `rails server -h` for more startup options
|
24
|
+
Puma starting in single mode...
|
25
|
+
* Version 3.10.0 (ruby 2.4.0-p0), codename: Russell's Teapot
|
26
|
+
* Min threads: 5, max threads: 5
|
27
|
+
* Environment: development
|
28
|
+
* Listening on tcp://0.0.0.0:8080
|
29
|
+
Use Ctrl-C to stop
|
30
|
+
Started GET "/" for 58.146.3.66 at 2017-10-27 15:49:31 +0000
|
31
|
+
Cannot render console from 58.146.3.66! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
|
32
|
+
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
|
33
|
+
Processing by Rails::WelcomeController#index as HTML
|
34
|
+
Rendering /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb
|
35
|
+
Rendered /usr/local/rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb (3.2ms)
|
36
|
+
Completed 200 OK in 18ms (Views: 8.4ms | ActiveRecord: 0.0ms)
|
21
37
|
|
38
|
+
|
39
|
+
|
22
40
|
###試したこと
|
23
41
|
課題に対してアプローチしたことを記載してください
|
24
42
|
|