質問編集履歴

3

タグ追加

2020/01/07 16:03

投稿

is02
is02

スコア17

test CHANGED
File without changes
test CHANGED
File without changes

2

routes.rbの追加

2020/01/07 16:03

投稿

is02
is02

スコア17

test CHANGED
File without changes
test CHANGED
@@ -212,6 +212,32 @@
212
212
 
213
213
  ```
214
214
 
215
+ routes.rb
216
+
217
+ ```
218
+
219
+ Rails.application.routes.draw do
220
+
221
+ devise_for :users
222
+
223
+ root 'post_images#index'
224
+
225
+ resources :post_images, only: [:new, :create, :index, :show, :destroy] do
226
+
227
+ resource :favorites, only: [:create, :destroy]
228
+
229
+ resource :post_comments, only: [:create, :destroy]
230
+
231
+ end
232
+
233
+ resources :users, only: [:show, :edit, :update]
234
+
235
+ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
236
+
237
+ end
238
+
239
+ ```
240
+
215
241
  ### 試したこと
216
242
 
217
243
  link_toのパスをpost_images_path(投稿一覧ページ)に変えたところrouting_errorになった

1

前提・実現したいことの修正

2020/01/07 15:09

投稿

is02
is02

スコア17

test CHANGED
File without changes
test CHANGED
@@ -2,10 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- 前提:いいねボタンは投稿一覧ページに実装済み
5
+ 前提:いいねボタンは投稿一覧ページ、投稿詳細ページに実装済み
6
6
 
7
7
  実現したいこと:いいねボタンを押しても投稿一覧ページに留まりたいが、カウントはしたい。
8
8
 
9
+ 投稿詳細ページは変わらずいいね機能を実装したい
10
+
9
11
 
10
12
 
11
13
  投稿一覧ページ:post_images/index.html.erb