Class: Spree::Api::CountriesController

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

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#map_nested_attributes_keys, #set_jsonp_format

Methods included from ControllerSetup

included

Instance Method Details

#indexObject



5
6
7
8
9
10
11
# File 'app/controllers/spree/api/countries_controller.rb', line 5

def index
  @countries = Country.ransack(params[:q]).result.
               includes(:states).order('name ASC').
               page(params[:page]).per(params[:per_page])

  respond_with(@countries)
end

#showObject



13
14
15
16
# File 'app/controllers/spree/api/countries_controller.rb', line 13

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