Sha256: 8d0e5e8b72c93509ab4b8ffa63a3532fe7fd1f751fbedd52c53005cab9c5f52f

Contents?: true

Size: 690 Bytes

Versions: 84

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

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

      def index
        @countries = Spree::Country.
          accessible_by(current_ability).
          ransack(params[:q]).
          result.
          order('name ASC')

        country = Spree::Country.order("updated_at ASC").last

        if stale?(country)
          @countries = paginate(@countries)
          respond_with(@countries)
        end
      end

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

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
solidus_api-4.4.1 app/controllers/spree/api/countries_controller.rb
solidus_api-4.4.0 app/controllers/spree/api/countries_controller.rb
solidus_api-4.3.4 app/controllers/spree/api/countries_controller.rb
solidus_api-4.2.4 app/controllers/spree/api/countries_controller.rb
solidus_api-4.1.5 app/controllers/spree/api/countries_controller.rb
solidus_api-4.3.3 app/controllers/spree/api/countries_controller.rb
solidus_api-4.3.2 app/controllers/spree/api/countries_controller.rb
solidus_api-4.1.4 app/controllers/spree/api/countries_controller.rb
solidus_api-4.3.1 app/controllers/spree/api/countries_controller.rb
solidus_api-4.3.0 app/controllers/spree/api/countries_controller.rb
solidus_api-4.2.3 app/controllers/spree/api/countries_controller.rb
solidus_api-4.1.3 app/controllers/spree/api/countries_controller.rb
solidus_api-4.0.4 app/controllers/spree/api/countries_controller.rb
solidus_api-3.4.6 app/controllers/spree/api/countries_controller.rb
solidus_api-4.0.3 app/controllers/spree/api/countries_controller.rb
solidus_api-4.1.2 app/controllers/spree/api/countries_controller.rb
solidus_api-4.2.2 app/controllers/spree/api/countries_controller.rb
solidus_api-3.4.5 app/controllers/spree/api/countries_controller.rb
solidus_api-4.2.1 app/controllers/spree/api/countries_controller.rb
solidus_api-4.2.0 app/controllers/spree/api/countries_controller.rb