Class: Spree::Api::CountriesController
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys
Instance Method Details
#index ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'app/controllers/spree/api/countries_controller.rb', line 6
def index
@countries = Country.accessible_by(current_ability, :read).ransack(params[:q]).result.
includes(:states).order('name ASC').
page(params[:page]).per(params[:per_page])
country = Country.order("updated_at ASC").last
if stale?(country)
respond_with(@countries)
end
end
|
#show ⇒ Object
16
17
18
19
|
# File 'app/controllers/spree/api/countries_controller.rb', line 16
def show
@country = Country.accessible_by(current_ability, :read).find(params[:id])
respond_with(@country)
end
|