Class: Spree::Api::V1::CountriesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v1/countries_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#content_type, #permitted_line_item_attributes

Methods included from ControllerSetup

included

Instance Method Details

#indexObject



7
8
9
10
11
12
13
# File 'app/controllers/spree/api/v1/countries_controller.rb', line 7

def index
  @countries = Country.accessible_by(current_ability, :read).ransack(params[:q]).result.
               order('name ASC').
               page(params[:page]).per(params[:per_page])
  country = Country.order('updated_at ASC').last
  respond_with(@countries) if stale?(country)
end

#showObject



15
16
17
18
# File 'app/controllers/spree/api/v1/countries_controller.rb', line 15

def show
  @country = Country.accessible_by(current_ability, :read).find(params[:id])
  respond_with(@country)
end