Module: Gitlab::SensitiveSerializableHash
- Extended by:
- ActiveSupport::Concern
- Includes:
- SensitiveAttributes
- Included in:
- ApplicationRecord
- Defined in:
- app/models/concerns/gitlab/sensitive_serializable_hash.rb
Instance Method Summary collapse
-
#serializable_hash(options = nil) ⇒ Object
Override serializable_hash to exclude sensitive attributes by default.
Instance Method Details
#serializable_hash(options = nil) ⇒ Object
Override serializable_hash to exclude sensitive attributes by default
In general, prefer NOT to use serializable_hash / to_json / as_json in favor of serializers / entities instead which has an allowlist of attributes
24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/concerns/gitlab/sensitive_serializable_hash.rb', line 24 def serializable_hash( = nil) = .try(:dup) || {} [:except] = Array([:except]).dup [:except].concat self.class.attributes_exempt_from_serializable_hash [:except].concat self.class.sensitive_attributes super() end |