You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.
This is an issue we met in our project when using this store credits extension. On our development env, all things worked fine. But when we run the app on QA envs. things goes mad. We always get store credits subtract twice. That means if u use $30 sc, it will subtract $60 from your remaining store credits.
After check the source code of sc extension, we find this is caused of the configuration inside spree_store_credits.rb. Inside the file, we have a condition statement use Rails env to configure the extension:
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env == "production" ? require(c) : load(c)
end
end
We can change the condition statement to follow to fix this issue:
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
Seems the require/load setting must be same as its host app of this extension.
The text was updated successfully, but these errors were encountered:
I've got a nasty little bug that shows up only in QA environments as well. I actually didn't test production (since my code isn't there yet), but my bug definitely shows up in QA + Staging environment but NOT development. I will post a separate issue.
When debugging this I noticed that on the spree2-0 stable branch of this gem this file contains a Rails.env == "production" which either requires or loads the files in the gem. (Load will load the file twice, thus doing all kinds of things like attaching duplicitous event handlers when using class_eval).
I am suspicious of this, of course, although I haven't actually identified it as my problem.
(if anyone ever tries to make an argument that it is EVER ok to use Rails.env to run things only one way in production, don't believe them. Never ever.)
On Spree 2.1, this gem does more things inconsistently between environments. In our case, it is showing the store credit on all screens leading up to the "Complete" step but the adjustment seems to get knocked off during the complete step. This manifests in some environments but not others. Also it is inconsistent even within the environment where the symptom manifests -- sometimes it happens, sometime it does not.
AMENDED: I was wrong about the symptom described above, and therefore I was also wrong about our problem being an environment-specific problem. I do know for sure that Version 1.3 and 2.0 of this gem have a environment-specific problems because of the Rails.env == "production" check mentioned in my comment from Dec 1st 2014. However, this code has been removed as of 2-1-stable and therefore I no longer think version 2-1-stable and 2-2-stable have environment-specific problems.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is an issue we met in our project when using this store credits extension. On our development env, all things worked fine. But when we run the app on QA envs. things goes mad. We always get store credits subtract twice. That means if u use $30 sc, it will subtract $60 from your remaining store credits.
After check the source code of sc extension, we find this is caused of the configuration inside spree_store_credits.rb. Inside the file, we have a condition statement use Rails env to configure the extension:
We can change the condition statement to follow to fix this issue:
Seems the require/load setting must be same as its host app of this extension.
The text was updated successfully, but these errors were encountered: