Class: Spree::Api::V2::CountriesController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
# File 'app/controllers/spree/api/v2/countries_controller.rb', line 7

def index
  render_collection Spree::Country.includes(:states)
end

#showObject



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

def show
  if params[:state_id].present?
    render_instance Spree::State.find_country(params[:state_id])
  else
    render_instance Spree::Country.find(params[:id])
  end
end