mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 04:36:21 +00:00
fix: no filtrar información privada en YAML.dump
This commit is contained in:
parent
368cb065ea
commit
330e82041b
1 changed files with 18 additions and 1 deletions
|
@ -7,6 +7,23 @@ class ApplicationRecord < ActiveRecord::Base
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def to_yaml(options = {})
|
def to_yaml(options = {})
|
||||||
self.class.inspection_filter.filter(serializable_hash).to_yaml(options)
|
pruned_attributes.to_yaml(options)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Devuelve todos los atributos menos los filtrados
|
||||||
|
#
|
||||||
|
# @return [Hash]
|
||||||
|
def pruned_attributes
|
||||||
|
self.class.inspection_filter.filter(serializable_hash)
|
||||||
|
end
|
||||||
|
|
||||||
|
# @param coder [Psych::Coder]
|
||||||
|
# @return nil
|
||||||
|
def encode_with(coder)
|
||||||
|
pruned_attributes.each_pair do |attr, value|
|
||||||
|
coder[attr] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue