Class: Spree::Admin::LabelsController

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

Instance Method Summary collapse

Instance Method Details

#collectionObject



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

def collection
  return @collection if @collection.present?
  params[:q] ||= {}
  @collection = super
  # @search needs to be defined as this is passed to search_form_for
  Ransack.options[:ignore_unknown_conditions] = false
  @search = @collection.ransack(params[:q])
  @collection = @search.result.
      page(params[:page]).
      per(params[:per_page] || Spree::Config[:admin_products_per_page])
  @collection
end

#indexObject



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

def index
  session[:return_to] = request.url
  respond_with @collection
end