Module: Spree::PreferenceSchema
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- app/models/concerns/spree/preference_schema.rb
Overview
Adds class-level helpers that surface a JSON-friendly description of a ‘Preferable` class’s ‘preference :name, :type, default:` declarations.
Used by the admin API (‘/payment_methods/types`, `/promotion_actions/types`, `/promotion_rules/types`) so that admin UIs can render configuration forms for any provider/action/rule subclass without hard-coding field lists.
Instance Method Summary collapse
-
#serialized_preferences ⇒ Hash{String => Object}
Wire-safe view of ‘preferences` with `:password`-typed values masked.
Instance Method Details
#serialized_preferences ⇒ Hash{String => Object}
Wire-safe view of ‘preferences` with `:password`-typed values masked. Lives here (not in the serializer) so any consumer holding a Preferable instance gets the same safety guarantee — secrets must never leave the server in plaintext. Keys are stringified to match the wire shape expected by JSON clients.
20 21 22 |
# File 'app/models/concerns/spree/preference_schema.rb', line 20 def serialized_preferences Spree::Preferences::Masking.serialize(self) end |