Skip to content

Instantly share code, notes, and snippets.

@matthewford
Created November 7, 2008 15:04
Show Gist options
  • Save matthewford/22880 to your computer and use it in GitHub Desktop.
Save matthewford/22880 to your computer and use it in GitHub Desktop.
From f81121312509f757694e1af7b19a7f7bf5f9cdac Mon Sep 17 00:00:00 2001
From: Matthew Ford <matt@new-bamboo.co.uk>
Date: Fri, 7 Nov 2008 15:00:41 +0000
Subject: [PATCH] avoid calling destroy on nil
---
dm-tags/lib/dm-tags/dm_tags.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dm-tags/lib/dm-tags/dm_tags.rb b/dm-tags/lib/dm-tags/dm_tags.rb
index e4864c5..430af4b 100644
--- a/dm-tags/lib/dm-tags/dm_tags.rb
+++ b/dm-tags/lib/dm-tags/dm_tags.rb
@@ -44,7 +44,7 @@ module DataMapper
deleted_#{arg}.each do |name|
tag = Tag.first(:name => name)
tagging = #{arg.to_s.singular}_taggings.first(:tag_id => tag.id)
- tagging.destroy
+ tagging.destroy if tagging
#{arg.to_s.singular}_taggings.reload
end
#{arg.to_s.singular}_list.each do |name|
--
1.5.4.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment