Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fixes #10175 removes upper limit for property value
Damian Legawiec1b02b69fd5a5
diff --git a/core/app/models/spree/product_property.rb b/core/app/models/spree/product_property.rbindex 418d539d3e..10584ed4a1 100644--- a/core/app/models/spree/product_property.rb+++ b/core/app/models/spree/product_property.rb@@ -9,8 +9,6 @@ module Spreevalidates :property, presence: true- validates :value, db_maximum_length: true-default_scope { order(:position) }self.whitelisted_ransackable_attributes = ['value']diff --git a/core/app/models/spree/validations/db_maximum_length_validator.rb b/core/app/models/spree/validations/db_maximum_length_validator.rbdeleted file mode 100644index dad26df306..0000000000--- a/core/app/models/spree/validations/db_maximum_length_validator.rb+++ /dev/null@@ -1,22 +0,0 @@-module Spree- module Validations- ##- # Validates a field based on the maximum length of the underlying DB field, if there is one.- class DbMaximumLengthValidator < ActiveModel::Validator- def initialize(options)- super- @field = options[:field].to_s- raise ArgumentError, 'a field must be specified to the validator' if @field.blank?- end-- def validate(record)- warn '`Spree::Validations::DbMaximumLengthValidator` is deprecated. Use `DbMaximumLengthValidator` instead.'- limit = record.class.columns_hash[@field].limit- value = record[@field.to_sym]- if value && limit && value.to_s.length > limit- record.errors.add(@field.to_sym, :too_long, count: limit)- end- end- end- end-enddiff --git a/core/app/validators/db_maximum_length_validator.rb b/core/app/validators/db_maximum_length_validator.rbindex 33a4002412..67a2b3e535 100644--- a/core/app/validators/db_maximum_length_validator.rb+++ b/core/app/validators/db_maximum_length_validator.rb@@ -2,6 +2,11 @@# Validates a field based on the maximum length of the underlying DB field, if there is one.class DbMaximumLengthValidator < ActiveModel::EachValidatordef validate_each(record, attribute, value)+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)+ `DbMaximumLengthValidator` is deprecated and will be removed in Spree 5.0.+ Please remove any `db_maximum_length: true` validations from your codebase+ DEPRECATION+limit = if defined?(Globalize)record.class.translation_class.columns_hash[attribute.to_s].limitelse