Sha256: 0c7427d1e13988783443b79767da44089cac7ad84a7facfe87fc1c8d497f668d

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module Spree
  module Admin
    module UsersControllerDecorator
      def self.prepended(base)
        base.before_action :load_use_codes, only: :avalara_information
      end

      def avalara_information
        if request.put? && @user.update_attributes(user_params)
          flash.now[:success] = Spree.t(:account_updated)
        end

        render :avalara_information
      end

      private

      def load_use_codes
        return if request.put?

        @use_codes = SpreeAvataxOfficial::EntityUseCode.all.map { |use_code| ["#{use_code.code} - #{use_code.name}", use_code.id] }
      end
    end
  end
end

::Spree::Admin::UsersController.prepend(Spree::Admin::UsersControllerDecorator)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_avatax_official-1.8.0 app/controllers/spree/admin/users_controller_decorator.rb
spree_avatax_official-1.7.1 app/controllers/spree/admin/users_controller_decorator.rb