spree-contrib / spree_multi_currency

Provides UI to allow configuring multiple currencies in Spree.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
41 stars 118 forks source link

Taxons API endpoint fails due as 'supported_currencies' is undefined #92

Open mdavo6 opened 5 years ago

mdavo6 commented 5 years ago

On Spree 3.1.

  1. Install spree_multi_currency gem.
  2. Click on "products --> taxons".
  3. Enter any taxon with products into the field and click.
  4. Products will not load as 'supported_currencies' is undefined.

Seems to be related to issue #42 raised by @jsilland. In short, this appears to occur because API controllers do not inherit from the ApplicationController, so do not have access to 'supported_currencies'.

I was able to resolve by creating a base_controller_decorator to include Spree::CurrencyHelpers, as suggested by @jsilland in issue #42 , per below:

Spree::Api::BaseController.class_eval do
   include Spree::CurrencyHelpers
end

Hope this helps anyone else who runs into this issue!