5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 01:26:21 +00:00
panel/app/models/application_record.rb

30 lines
615 B
Ruby
Raw Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2018-01-02 17:19:25 +00:00
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
2024-04-15 19:58:55 +00:00
# Obtener una lista filtrada de atributos al momento de serializar
#
2024-04-15 20:10:19 +00:00
# @return [String]
2024-04-15 19:58:55 +00:00
def 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
2024-04-15 19:58:55 +00:00
end
2018-01-02 17:19:25 +00:00
end