質問編集履歴

2

付け足し

2020/12/28 04:38

投稿

naoya0922
naoya0922

スコア23

test CHANGED
File without changes
test CHANGED
@@ -195,3 +195,99 @@
195
195
 
196
196
 
197
197
  ```
198
+
199
+
200
+
201
+ ```
202
+
203
+ Rails.application.routes.draw do
204
+
205
+ root to: 'toppages#index'
206
+
207
+
208
+
209
+ get 'login', to: 'sessions#new'
210
+
211
+ post 'login', to: 'sessions#create'
212
+
213
+ delete 'logout', to: 'sessions#destroy'
214
+
215
+
216
+
217
+ get 'signup', to: 'users#new'
218
+
219
+ resources :users, only: [:index, :show, :new, :create] do
220
+
221
+ member do
222
+
223
+ get :followings
224
+
225
+ get :followers
226
+
227
+ end
228
+
229
+ end
230
+
231
+ =begin
232
+
233
+ resources :users, only: [:index, :show, :new, :create] do
234
+
235
+ post :likes
236
+
237
+ end
238
+
239
+ =end
240
+
241
+ resources :microposts, only: [:create, :destroy]
242
+
243
+ resources :relationships, only: [:create, :destroy]
244
+
245
+ resources :favorites , only: [:create, :destroy]
246
+
247
+
248
+
249
+ end
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ Prefix Verb URI Pattern Controller#Action
258
+
259
+ root GET / toppages#index
260
+
261
+ login GET /login(.:format) sessions#new
262
+
263
+ POST /login(.:format) sessions#create
264
+
265
+ logout DELETE /logout(.:format) sessions#destroy
266
+
267
+ signup GET /signup(.:format) users#new
268
+
269
+ followings_user GET /users/:id/followings(.:format) users#followings
270
+
271
+ followers_user GET /users/:id/followers(.:format) users#followers
272
+
273
+ users GET /users(.:format) users#index
274
+
275
+ POST /users(.:format) users#create
276
+
277
+ new_user GET /users/new(.:format) users#new
278
+
279
+ user GET /users/:id(.:format) users#show
280
+
281
+ microposts POST /microposts(.:format) microposts#create
282
+
283
+ micropost DELETE /microposts/:id(.:format) microposts#destroy
284
+
285
+ relationships POST /relationships(.:format) relationships#create
286
+
287
+ relationship DELETE /relationships/:id(.:format) relationships#destroy
288
+
289
+ favorites POST /favorites(.:format) favorites#create
290
+
291
+ favorite DELETE /favorites/:id(.:format) favorites#destroy
292
+
293
+ ```

1

文章訂正

2020/12/28 04:37

投稿

naoya0922
naoya0922

スコア23

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  <% if current_user.already_favorite?(micropost) %>
48
48
 
49
- <%= form_with(model: current_user.relationships.find_by(micropost_id: micropost.id), local: true, method: :delete) do |f| %>
49
+ <%= form_with(model: current_user.favorites.find_by(micropost_id: micropost.id), local: true, method: :delete) do |f| %>
50
50
 
51
51
  <%= hidden_field_tag :micropost_id, micropost.id %>
52
52