Module: Logidze::IgnoreLogData::MissingAttributePatch

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

Overview

Rails attribute API defines attributes in a way, that it returns nil when data has not been loaded from the DB. We want it to imitate the behavior from Rails 4 - raise ActiveModel::MissingAttributeError

Instance Method Summary collapse

Instance Method Details

#log_dataObject

Raises:

  • (ActiveModel::MissingAttributeError)


9
10
11
12
13
# File 'lib/logidze/ignore_log_data/missing_attribute_patch.rb', line 9

def log_data
  raise ActiveModel::MissingAttributeError if attributes["log_data"].nil?

  super
end