Class: Spree::Api::FeedbackReviewsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Api::FeedbackReviewsController
- Defined in:
- lib/controllers/spree/api/feedback_reviews_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/controllers/spree/api/feedback_reviews_controller.rb', line 14 def create if @review.present? @feedback_review = @review.feedback_reviews.new(feedback_review_params) @feedback_review.user = @current_api_user @feedback_review.locale = I18n.locale.to_s if Spree::Reviews::Config[:track_locale] end :create, @feedback_review if @feedback_review.save render json: @feedback_review, status: :created else invalid_resource!(@feedback_review) end end |
#destroy ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/controllers/spree/api/feedback_reviews_controller.rb', line 39 def destroy :destroy, @feedback_review if @feedback_review.destroy render json: @feedback_review, status: :ok else invalid_resource!(@feedback_review) end end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/controllers/spree/api/feedback_reviews_controller.rb', line 29 def update :update, @feedback_review if @feedback_review.update(feedback_review_params) render json: @feedback_review, status: :ok else invalid_resource!(@feedback_review) end end |