Skip to content
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

Can't save flat rate calculator because of Psych::DisallowedClass #79

Open
winstonferguson opened this issue Jul 13, 2024 · 1 comment

Comments

@winstonferguson
Copy link

Encountered when trying to create a flat rate calculator in the Admin namespace.

As I have another project using the spree_backend gem without this issue, I'm reporting it here.

Context

This is a fresh spree_rails_frontend install (4.8.0). On a local machine using Rbenv.

Expected Behavior

Calculator is saved.

Actual Behavior

Psych::DisallowedClass in Spree::Admin::ShippingMethodsController#update
Tried to dump unspecified class: BigDecimal

/.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:571:in accept' /.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:331:in block in visit_Hash'
/.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:329:in each' /.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:329:in visit_Hash'
/.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:135:in accept' /.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:574:in accept'
/.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych/visitors/yaml_tree.rb:117:in push' /.rbenv/versions/3.3.0/lib/ruby/3.3.0/psych.rb:585:in safe_dump'
activerecord (7.1.3.4) lib/active_record/coders/yaml_column.rb:19:in `dump'

Possible Fix

Ensure class is permitted.

Add:

config.active_record.yaml_column_permitted_classes << BigDecimal

Reference:

rails/rails#45826
https://stackoverflow.com/questions/74312283/tried-to-load-unspecified-class-activesupporttimewithzone-psychdisallowed

@FrederikKragh
Copy link

I am encountering the same error when creating a flat rate calculator for my Shipping Method. In addition I am encountering it when trying to add a flat rate Action to my promotion

Psych::DisallowedClass in Spree::Admin::PromotionsController#update

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

No branches or pull requests

2 participants