Class: Admin::ReviewsController

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

Instance Method Summary collapse

Instance Method Details

#approveObject



17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/reviews_controller.rb', line 17

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

  if r.update_attribute(:approved, true)
     r.product.recalculate_rating
     flash[:notice] = t("info_approve_review")
  else
     flash[:error] = t("error_approve_review")
  end
  redirect_to admin_reviews_path
end

#indexObject



4
5
6
7
# File 'app/controllers/admin/reviews_controller.rb', line 4

def index
  @unapproved_reviews = Review.not_approved.find(:all, :order => "created_at DESC")
  @approved_reviews   = Review.approved.find(:all, :order => "created_at DESC")
end