質問編集履歴

1

説明の追加

2018/01/23 05:30

投稿

YousukeTanaka
YousukeTanaka

スコア79

test CHANGED
File without changes
test CHANGED
@@ -84,6 +84,26 @@
84
84
 
85
85
  ```
86
86
 
87
+ controller
88
+
89
+ ```ここに言語を入力
90
+
91
+ def booking_cancel
92
+
93
+ @listing = Listing.find(params[:listing_id])
94
+
95
+ @reservation = @listing.reservations.find_by(params[:reservation_id]).update!(status: :booking_cancel)
96
+
97
+ if @reservation.booking_cancel?
98
+
99
+ redirect_to listing_path(@listing), notice: 'ご予約は取り消されました。'
100
+
101
+ end
102
+
103
+ end
104
+
105
+ ```
106
+
87
107
 
88
108
 
89
109
  上記のコードで飛ぶactionは別の名前のaction(controllerは同じ)になります。