Class: Spree::Admin::ReviewsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/admin/reviews_controller.rb

Instance Method Summary collapse

Instance Method Details

#approveObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/admin/reviews_controller.rb', line 10

def approve
  review = Spree::Review.find(params[:id])

  if review.update_attribute(:approved, true)
    flash[:success] = I18n.t('spree.info_approve_review')
  else
    flash[:error] = I18n.t('spree.error_approve_review')
  end

  redirect_to admin_reviews_path
end

#editObject



22
23
24
25
26
27
# File 'app/controllers/spree/admin/reviews_controller.rb', line 22

def edit
  if @review.product.nil?
    flash[:error] = I18n.t('spree.error_no_product')
    redirect_to admin_reviews_path
  end
end

#indexObject



6
7
8
# File 'app/controllers/spree/admin/reviews_controller.rb', line 6

def index
  @reviews = collection
end