Sha256: 14f957359fa797ca10661c911cb7b57494620c3b6afded276758a10f9a0abb44

Contents?: true

Size: 659 Bytes

Versions: 28

Compression:

Stored size: 659 Bytes

Contents

module Spree
  module Admin
    class StockLocationsController < ResourceController

      before_filter :set_country, :only => :new

      private

      def set_country
        begin
          if Spree::Config[:default_country_id].present?
            @stock_location.country = Spree::Country.find(Spree::Config[:default_country_id])
          else
            @stock_location.country = Spree::Country.find_by!(iso: 'US')
          end

        rescue ActiveRecord::RecordNotFound
          flash[:error] = Spree.t(:stock_locations_need_a_default_country)
          redirect_to admin_stock_locations_path and return
        end
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
spree_backend-2.3.13 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.14 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.12 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.13 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.11 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.12 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.10 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.9 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.11 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.10 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.8 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.7 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.9 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.6 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.8 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.5 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.7 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.4 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.2.6 app/controllers/spree/admin/stock_locations_controller.rb
spree_backend-2.3.3 app/controllers/spree/admin/stock_locations_controller.rb