-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include CamaleonCms::SessionHelper in global scope is unhealthy #9
Comments
This plugin was not updated since Camaleon_cms 1.x, if you can fix and update I will appreciate. |
I am trying to do that, however running into current_user being nil right now. The impression I get is that camaleon-oauth is overwriting some global state set up by camaleon-cms because I am able to check out using a test camaleon-cms installation with camaleon-ecommerce but without camaleon-oauth. Here is a stack trace: - draper (2.1.0) lib/draper/helper_proxy.rb:35:in `block in define_proxy' - /home/oleg/apps/backend/vendor/cache/camaleon-cms-1d25088e16b3/app/helpers/camaleon_cms/session_helper.rb:144:in `cama_calc_api_current_user' - /home/oleg/apps/backend/vendor/cache/camaleon-cms-1d25088e16b3/app/helpers/camaleon_cms/session_helper.rb:110:in `cama_current_user' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/decorators/plugins/ecommerce/product_decorator.rb:108:in `the_qty_real' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/decorators/plugins/ecommerce/product_item_decorator.rb:34:in `decrement_qty!' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/models/plugins/ecommerce/cart.rb:82:in `block in make_order!' - draper (2.1.0) lib/draper/delegation.rb:10:in `each' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/models/plugins/ecommerce/cart.rb:82:in `make_order!' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/models/plugins/ecommerce/cart.rb:148:in `make_paid!' - draper (2.1.0) lib/draper/delegation.rb:10:in `make_paid!' - draper (2.1.0) lib/draper/automatic_delegation.rb:10:in `method_missing' - /home/oleg/apps/backend/vendor/cache/camaleon-ecommerce-a8543f617be2/app/helpers/plugins/ecommerce/ecommerce_email_helper.rb:5:in `mark_order_like_received' How is mark_order_like_received/make_paid!/make_order! intended to make current_user work? Here is something else related. (byebug) prod.current_user #, @context={}> (byebug) prod.cama_current_user *** NoMethodError Exception: undefined method `cama_current_user' for # nil Where is the current_user method defined that ends up being on the product instance? |
This:
https://github.com/owen2345/camaleon_oauth/blob/master/config/initializers/doorkeeper.rb#L1
makes methods like
current_user
available in the global scope.However,
current_user
invokescama_calc_api_current_user
which invokesdoorkeeper_token
.doorkeeper_token
is not available in the global scope, hencecurrent_user
fails.Furthermore,
cama_current_user
has a cache for the current user value -@cama_current_user
. This is an instance variable which again is not accessible from the global scope.Instead of putting methods into the global scope, specific classes or modules should
include CamaleonCms::SessionHelper
etc.The text was updated successfully, but these errors were encountered: