-
Notifications
You must be signed in to change notification settings - Fork 41
Description
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