Class: Spree::Billing::VariantsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/billing/variants_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#collection_url, #current_vendor, #default_url_options, #edit_object_url, #handle_unauthorized_vendor, #page, #per_page, #required_vendor_user!, #set_locale, #switch_vendor, #vendors

Methods included from SpreeCmCommissioner::Billing::RoleAuthorization

#auth_action, #auth_entry, #auth_user, #authorize!, #authorize?, #authorize_admin, #authorize_role!, #redirect_unauthorized_access

Instance Method Details

#collectionObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/spree/billing/variants_controller.rb', line 7

def collection
  return @collection if @collection.present?

  params[:q] ||= {}
  @deleted = params[:q].delete(:deleted_at_null) || '0'
  @collection = super
  @collection = @collection.deleted if @deleted == '1'
  # @search needs to be defined as this is passed to search_link
  @search = @collection.ransack(params[:q])
  @collection = @search.result
                       .page(params[:page])
                       .per(params[:per_page] || Spree::Backend::Config[:variants_per_page])
end