質問編集履歴
3
修正点の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,7 +124,7 @@
|
|
124
124
|
|
125
125
|
@prototype = Prototype.create(prototype_params)
|
126
126
|
|
127
|
-
if @prototype
|
127
|
+
if @prototype.save
|
128
128
|
|
129
129
|
redirect_to root_path
|
130
130
|
|
2
エラー文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,7 +34,29 @@
|
|
34
34
|
|
35
35
|
Routes
|
36
36
|
|
37
|
-
Routes match in priority from top to bottom
|
37
|
+
Routes match in priority from top to bottom
|
38
|
+
|
39
|
+
Request
|
40
|
+
|
41
|
+
Parameters:
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
{"authenticity_token"=>"iMFsxHjUGk9ZLXCQb0jmase2O/KjhjD9LuLYI7ZTQ3rC1crNukf4EkjDG3EY5WBew32FEqq/htakRgtzcsmUgA==", "title"=>"aaaa", "catct_copy"=>"aaaa", "concept"=>"aaaa", "commit"=>"保存する"}
|
46
|
+
|
47
|
+
Toggle session dump
|
48
|
+
|
49
|
+
Toggle env dump
|
50
|
+
|
51
|
+
Response
|
52
|
+
|
53
|
+
Headers:
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
None
|
58
|
+
|
59
|
+
```
|
38
60
|
|
39
61
|
|
40
62
|
|
1
エラー文の写真のurlを貼りました
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,105 +14,153 @@
|
|
14
14
|
|
15
15
|
エラーメッセージ
|
16
16
|
|
17
|
+
https://gyazo.com/9ce4c70f76cd8fc12de4daccd7d73cd8
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
エラー文です
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
Routing Error
|
26
|
+
|
27
|
+
No route matches [POST] "/prototypes/new"
|
28
|
+
|
29
|
+
Rails.root: /Users/kamiyaryota/Desktop/projects/protospace-31035
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
Application Trace | Framework Trace | Full Trace
|
34
|
+
|
35
|
+
Routes
|
36
|
+
|
37
|
+
Routes match in priority from top to bottom```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
該当コード
|
44
|
+
|
45
|
+
routes.rbです
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
|
49
|
+
Rails.application.routes.draw do
|
50
|
+
|
51
|
+
devise_for :users
|
52
|
+
|
53
|
+
root to: "prototypes#index"
|
54
|
+
|
55
|
+
resources :users, only: [:new, :edit, :update,]
|
56
|
+
|
57
|
+
resources :prototypes, only: [:new, :create]
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
devise_scope :user do
|
62
|
+
|
63
|
+
get '/users/sign_out' => 'devise/sessions#destroy'
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
コントローラー.rbです
|
78
|
+
|
17
79
|
```ruby
|
18
80
|
|
19
|
-
Routing Error
|
20
|
-
|
21
|
-
No route matches [POST] "/prototypes/new"
|
22
|
-
|
23
|
-
```
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
該当コード
|
28
|
-
|
29
|
-
routes.rbです
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
|
33
|
-
Rails.application.routes.draw do
|
34
|
-
|
35
|
-
devise_for :users
|
36
|
-
|
37
|
-
root to: "prototypes#index"
|
38
|
-
|
39
|
-
resources :users, only: [:new, :edit, :update,]
|
40
|
-
|
41
|
-
|
81
|
+
class PrototypesController < ApplicationController
|
42
|
-
|
43
|
-
|
44
|
-
|
82
|
+
|
83
|
+
|
84
|
+
|
45
|
-
de
|
85
|
+
def index
|
46
|
-
|
47
|
-
|
86
|
+
|
87
|
+
|
48
88
|
|
49
89
|
end
|
50
90
|
|
91
|
+
|
92
|
+
|
93
|
+
def new
|
94
|
+
|
95
|
+
@prototype = Prototype.new
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
def create
|
102
|
+
|
103
|
+
@prototype = Prototype.create(prototype_params)
|
104
|
+
|
105
|
+
if @prototype_create.save
|
106
|
+
|
107
|
+
redirect_to root_path
|
108
|
+
|
109
|
+
else
|
110
|
+
|
111
|
+
render :new
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def prototype_params
|
128
|
+
|
129
|
+
params.require(:prototype).permit(:title, :catct_copy, :concept).merge(user_id: current_user.id)
|
130
|
+
|
131
|
+
end
|
132
|
+
|
51
133
|
|
52
134
|
|
53
135
|
end
|
54
136
|
|
55
|
-
|
56
|
-
|
57
|
-
```
|
137
|
+
```
|
58
|
-
|
59
|
-
|
60
|
-
|
138
|
+
|
139
|
+
|
140
|
+
|
61
|
-
|
141
|
+
model.rbです
|
62
|
-
|
142
|
+
|
63
|
-
```r
|
143
|
+
```ryby
|
64
|
-
|
144
|
+
|
65
|
-
class Prototype
|
145
|
+
class Prototype < ApplicationRecord
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
146
|
+
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
def new
|
78
|
-
|
79
|
-
@prototype = Prototype.new
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
def create
|
86
|
-
|
87
|
-
@prototype = Prototype.create(prototype_params)
|
88
|
-
|
89
|
-
if @prototype_create.save
|
90
|
-
|
91
|
-
|
147
|
+
has_many :comments
|
92
|
-
|
93
|
-
|
148
|
+
|
94
|
-
|
95
|
-
|
149
|
+
belongs_to :user
|
96
|
-
|
97
|
-
|
150
|
+
|
98
|
-
|
99
|
-
|
151
|
+
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
152
|
+
|
110
|
-
|
111
|
-
|
153
|
+
has_one_attached :image
|
154
|
+
|
155
|
+
|
156
|
+
|
112
|
-
|
157
|
+
validates :title, presence: true
|
158
|
+
|
113
|
-
|
159
|
+
validates :catct_copy, presence: true
|
160
|
+
|
114
|
-
|
161
|
+
validates :concept, presence: true
|
162
|
+
|
115
|
-
en
|
163
|
+
validates :image, presence: true
|
116
164
|
|
117
165
|
|
118
166
|
|
@@ -122,38 +170,6 @@
|
|
122
170
|
|
123
171
|
|
124
172
|
|
125
|
-
model.rbです
|
126
|
-
|
127
|
-
```ryby
|
128
|
-
|
129
|
-
class Prototype < ApplicationRecord
|
130
|
-
|
131
|
-
has_many :comments
|
132
|
-
|
133
|
-
belongs_to :user
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
has_one_attached :image
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
validates :title, presence: true
|
142
|
-
|
143
|
-
validates :catct_copy, presence: true
|
144
|
-
|
145
|
-
validates :concept, presence: true
|
146
|
-
|
147
|
-
validates :image, presence: true
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
```
|
154
|
-
|
155
|
-
|
156
|
-
|
157
173
|
|
158
174
|
|
159
175
|
*投稿ページです*
|