Sha256: a3ab5068b7dff05567ae6d86b7c588ab19cf672ac1bf0af2e5bd105e11d3725a
Contents?: true
Size: 718 Bytes
Versions: 9
Compression:
Stored size: 718 Bytes
Contents
module Spree module Metadata extend ActiveSupport::Concern included do attribute :public_metadata, default: {} attribute :private_metadata, default: {} if Rails::VERSION::STRING >= '7.1.0' serialize :public_metadata, coder: HashSerializer serialize :private_metadata, coder: HashSerializer else serialize :public_metadata, HashSerializer serialize :private_metadata, HashSerializer end end # https://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails class HashSerializer def self.dump(hash) hash end def self.load(hash) (hash || {}).with_indifferent_access end end end end
Version data entries
9 entries across 9 versions & 1 rubygems