質問編集履歴
1
routes.rbとrails routesの結果を追加。
test
CHANGED
File without changes
|
test
CHANGED
@@ -153,3 +153,47 @@
|
|
153
153
|
RubyGems 3.0.3
|
154
154
|
|
155
155
|
Rails 5.2.3
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
### 追記
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
**routes.rb**
|
164
|
+
|
165
|
+
```
|
166
|
+
|
167
|
+
get "posts/:id" => "posts#show"
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
resources :posts do
|
172
|
+
|
173
|
+
resources :comments, only: [:create, :destroy]
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
```
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
**rails routesの結果**
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
Prefix Verb URI Pattern Controller#Action
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
post GET /posts/:id(.:format) posts#show
|
190
|
+
|
191
|
+
PATCH /posts/:id(.:format) posts#update
|
192
|
+
|
193
|
+
PUT /posts/:id(.:format) posts#update
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
post_comments POST /posts/:post_id/comments(.:format) comments#create
|
198
|
+
|
199
|
+
```
|