Class: V2Users::Reviews::PhotosController
- Inherits:
-
BaseController
- Object
- BaseController
- V2Users::Reviews::PhotosController
- Defined in:
- app/controllers/v2_users/reviews/photos_controller.rb
Overview
typed: ignore
Instance Attribute Summary collapse
-
#reservation ⇒ Object
Returns the value of attribute reservation.
-
#review ⇒ Object
Returns the value of attribute review.
Instance Method Summary collapse
Instance Attribute Details
#reservation ⇒ Object
Returns the value of attribute reservation.
8 9 10 |
# File 'app/controllers/v2_users/reviews/photos_controller.rb', line 8 def reservation @reservation end |
#review ⇒ Object
Returns the value of attribute review.
8 9 10 |
# File 'app/controllers/v2_users/reviews/photos_controller.rb', line 8 def review @review end |
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 |
# File 'app/controllers/v2_users/reviews/photos_controller.rb', line 10 def create return render json: { success: false } if reservation.id != review.reservation_id rp = ReviewPhoto.create!(photo: params.require(:file), review_id: review.id) render json: { success: true, id: rp.id } end |
#destroy ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/v2_users/reviews/photos_controller.rb', line 17 def destroy rp = ReviewPhoto.find(params.require(:id)) rp.destroy! render json: { success: true } end |