Sha256: fa03c1857be583e0f0be557e027a215f6668183aa134c7780db19d3331ff9138

Contents?: true

Size: 733 Bytes

Versions: 15

Compression:

Stored size: 733 Bytes

Contents

module Spree
  module Api
    class CountriesController < Spree::Api::BaseController
      skip_before_action :check_for_user_or_api_key
      skip_before_action :authenticate_user

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spree_api-3.0.10 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.9 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.8 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.7 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.6.1 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.6 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.5 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.4 app/controllers/spree/api/countries_controller.rb
spree_api-2.4.10 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.3 app/controllers/spree/api/countries_controller.rb
spree_api-2.4.9 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.2 app/controllers/spree/api/countries_controller.rb
spree_api-2.4.8 app/controllers/spree/api/countries_controller.rb
spree_api-3.0.1 app/controllers/spree/api/countries_controller.rb
spree_api-2.4.7 app/controllers/spree/api/countries_controller.rb