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

#indexObject



9
10
11
12
13
14
15
# File 'app/controllers/spree/admin/reviews_controller.rb', line 9

def index
  # Eager load product and user to prevent N+1 queries
  @product_reviews = Spree::ProductReview.accessible_by(current_ability)
                                         .includes(:product, :user, images_attachments: :blob)
                                         .order(created_at: :desc)
                                         .page(params[:page])
end

#model_classObject

We map this controller to the Spree::ProductReview model



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

def model_class
  Spree::ProductReview
end