Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Prevent DirtyMinder from attempting to wrap nil values. #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/dm-types/support/dirty_minder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ def track(resource, property)

# This catches any direct assignment, allowing us to hook the Hash or Array.
def set(resource, value)
hook_value(resource, value) unless value.kind_of? Hooker
hook_value(resource, value) unless value.nil? || value.kind_of?(Hooker)
super
end

# This gets called when Resource#reload is called (instead of #set).
def set!(resource, value)
hook_value(resource, value) unless value.kind_of? Hooker
hook_value(resource, value) unless value.nil? || value.kind_of?(Hooker)
super
end

private
private

def hook_value(resource, value)
return if value.kind_of? Hooker
Expand Down