Module: Logidze::IgnoreLogData::CastAttributePatch

Defined in:
lib/logidze/ignore_log_data/cast_attribute_patch.rb

Overview

Fixes unexpected behavior (see more github.com/rails/rails/pull/34528): instead of using a type passed to ‘attribute` call, ignored column uses a type coming from the DB (in this case `.log_data` would return a plain hash instead of `Logidze::History`)

Instance Method Summary collapse

Instance Method Details

#log_dataObject



10
11
12
13
14
# File 'lib/logidze/ignore_log_data/cast_attribute_patch.rb', line 10

def log_data
  return attributes["log_data"] if attributes["log_data"].is_a?(Logidze::History)

  self.log_data = Logidze::History::Type.new.cast_value(super)
end