Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

undefined method `supported_currencies' for #<Spree::AppConfiguration:0x00007fc93c9152f0>) #99

Open
tasdendu opened this issue Apr 27, 2020 · 11 comments

Comments

@tasdendu
Copy link

tasdendu commented Apr 27, 2020

Screen Shot 2020-04-27 at 6 02 58 PM

How do we define `supported_currencies`, I have tried all possible options like
Spree::Config.supported_currencies = ['USD', 'EUD']
Spree::Config[:supported_currencies] = ['USD', 'EUD']
Spree::Config['supported_currencies'] = ['USD', 'EUD']

None of the above configuration work for me. Can some one help me please.

@Tashows
Copy link

Tashows commented May 20, 2020

I am trying to figure this out too. This looks like a very basic step to be missing from the setup.

Edit: There is a field in the admin section. You basically add them in a field coma-separated. "USD, EUR" and they work.

@MatthewKennedy
Copy link
Contributor

@iamsid-das
Copy link

@Tashows Can you elaborate your solution a little more. Whereabout in the admin section?

@MatthewKennedy
Copy link
Contributor

Hi @Voyotel

I don't think you will find a fix for this from something in the admin, its happening because the preferences have not been initiated properly when the app loads.

What version of Spree are you using and what version of rails are you using?

@iamsid-das
Copy link

@MatthewKennedy I'm in Spree 4.1 and rails 6.0.3

@MatthewKennedy
Copy link
Contributor

@Voyotel If you replace the spree-contrib version with this:

gem 'spree_multi_currency', github: 'spree-four/spree_multi_currency'

That should work fine.

The multi currency functionality is being built into Spree 4.2 so at some point that extension will be a legacy extension.

@iamsid-das
Copy link

@MatthewKennedy Thanks! That worked :)

@mrublya
Copy link

mrublya commented Jul 23, 2020

Hi all, adding this to the file application.rb helped me to resolve this problem

  config.after_initialize do
    Spree::Config.allow_currency_change  = true
    Spree::Config.show_currency_selector = true
    Spree::Config.supported_currencies   = 'GBP,USD,EUR'
  end

@tasdendu
Copy link
Author

@Voyotel If you replace the spree-contrib version with this:

gem 'spree_multi_currency', github: 'spree-four/spree_multi_currency'

That should work fine.

The multi currency functionality is being built into Spree 4.2 so at some point that extension will be a legacy extension.

This is not the solution. We should figure it out how to fix the current problem.

@tasdendu
Copy link
Author

Hi all, adding this to the file application.rb helped me to resolve this problem

  config.after_initialize do
    Spree::Config.allow_currency_change  = true
    Spree::Config.show_currency_selector = true
    Spree::Config.supported_currencies   = 'GBP,USD,EUR'
  end

This looks like promising solution. Let me check and see if it is working.

@jembuiltit
Copy link

Hi all, adding this to the file application.rb helped me to resolve this problem

  config.after_initialize do
    Spree::Config.allow_currency_change  = true
    Spree::Config.show_currency_selector = true
    Spree::Config.supported_currencies   = 'GBP,USD,EUR'
  end
This looks like promising solution. Let me check and see if it is working.

this did not work for me .... @tashi-179 and the repo seems to have moved @MatthewKennedy so I can't try your idea.

when I add the above I get app/models/spree/preferences/configuration.rb:64:in method_missing': undefined method allow_currency_change=' for #<Spree::AppConfiguration:0x00007fb40d0e5f10> (NoMethodError)

so I remove the first line and so on...but no good

# 
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'spree', '~> 4.1'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants