Class: Spree::FeedbackReviewsController

Inherits:
StoreController
  • Object
show all
Defined in:
app/controllers/spree/feedback_reviews_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/spree/feedback_reviews_controller.rb', line 9

def create
  if @review.present?
    @feedback_review = @review.feedback_reviews.new(feedback_review_params)
    @feedback_review.user = spree_current_user
    @feedback_review.locale = I18n.locale.to_s if Spree::Reviews::Config[:track_locale]
    authorize! :create, @feedback_review
    @feedback_review.save
  end

  respond_to do |format|
    format.html { redirect_back(fallback_location: root_path) }
    format.js { render action: :create }
  end
end