質問編集履歴

1

config/routes.rbを追加しました

2019/10/18 00:09

投稿

bok_sakai
bok_sakai

スコア20

test CHANGED
File without changes
test CHANGED
@@ -216,6 +216,134 @@
216
216
 
217
217
 
218
218
 
219
+ ### routes
220
+
221
+ ```Ruby
222
+
223
+ #routes.rb
224
+
225
+
226
+
227
+ Rails.application.routes.draw do
228
+
229
+
230
+
231
+ #-順番変えちゃダメ---------------------------------------
232
+
233
+
234
+
235
+ # 新規登録・ログイン後のページを指定
236
+
237
+ root to: "home#top"
238
+
239
+
240
+
241
+ # ログイン、アカウント編集後、任意のページに推移させるための記述
242
+
243
+ devise_for :users, :controllers => {
244
+
245
+ :registrations => 'users/registrations',
246
+
247
+ :sessions => 'users/sessions'
248
+
249
+ }
250
+
251
+
252
+
253
+ devise_scope :user do
254
+
255
+ get "signup", :to => "users/registrations#new"
256
+
257
+ get "login", :to => "users/sessions#new"
258
+
259
+ get "logout", :to => "users/sessions#destroy"
260
+
261
+ get 'users/:id/setting', to: 'users/registrations#edit'
262
+
263
+ patch 'users/:id/update', to: 'users/registrations#update'
264
+
265
+ end
266
+
267
+
268
+
269
+ resources :users, only: [:show]
270
+
271
+
272
+
273
+ #----------------------------------------------------
274
+
275
+
276
+
277
+ # ホームページ
278
+
279
+ get '/' => "home#top"
280
+
281
+
282
+
283
+ # 検索ぺージ
284
+
285
+ get 'search' => "home#search"
286
+
287
+
288
+
289
+
290
+
291
+ # 新規投稿関係
292
+
293
+ get 'newpost' => "login_user#newpost"
294
+
295
+ post 'create' => "login_user#create"
296
+
297
+ get 'created' => "login_user#postcreate"
298
+
299
+
300
+
301
+ # 投稿詳細ページ
302
+
303
+ get 'post/:id' => "posts#show"
304
+
305
+
306
+
307
+ # 投稿編集ページ
308
+
309
+ get 'post/:id/edit' => "posts#edit"
310
+
311
+ post 'post/:id/update' => "posts#update"
312
+
313
+
314
+
315
+ # 投稿削除ページ
316
+
317
+ delete 'post/:id/destroy' => "posts#destroy"
318
+
319
+ post 'post/:id/destroy' => "posts#destroy"
320
+
321
+
322
+
323
+
324
+
325
+ #アカウント編集ページ
326
+
327
+ get 'users/:id/account/edit' => "users#edit"
328
+
329
+
330
+
331
+ # ユーザー詳細ページ
332
+
333
+ get 'users/:id' => "users#show"
334
+
335
+
336
+
337
+ # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
338
+
339
+ end
340
+
341
+
342
+
343
+ ```
344
+
345
+
346
+
219
347
  ### 試したこと1
220
348
 
221
349