module ActiveRecord::NestedAttributes

def has_destroy_flag?(hash)

Determines if a hash contains a truthy _destroy key.
def has_destroy_flag?(hash)
  Type::Boolean.new.cast(hash["_destroy"])
end