From db411860c2076f1f791bfa24e88d903cfcc13b02 Mon Sep 17 00:00:00 2001
From: Erik Ordway <ordwaye@evergreen.edu>
Date: Mon, 24 Feb 2014 16:11:31 -0800
Subject: [PATCH 1/2] clean up plugin store when removing data instead of
 setting the value to nil.

---
 app/models/plugin_store.rb       |  7 +++++++
 spec/models/plugin_store_spec.rb | 11 +++++++++++
 2 files changed, 18 insertions(+)

diff --git a/app/models/plugin_store.rb b/app/models/plugin_store.rb
index 82a30c711..dab22ad8f 100644
--- a/app/models/plugin_store.rb
+++ b/app/models/plugin_store.rb
@@ -22,6 +22,13 @@ class PluginStore
     row.save
   end
 
+  def self.remove(plugin_name, key)
+    if row = PluginStoreRow.where(plugin_name: plugin_name, key: key).first
+      row.destroy
+    end
+  end
+
+
   protected
 
 
diff --git a/spec/models/plugin_store_spec.rb b/spec/models/plugin_store_spec.rb
index e08788c5b..1a3f69296 100644
--- a/spec/models/plugin_store_spec.rb
+++ b/spec/models/plugin_store_spec.rb
@@ -10,6 +10,10 @@ describe PluginStore do
     PluginStore.get("my_plugin", k)
   end
 
+  def remove_row(k)
+    PluginStore.remove("my_plugin", k)
+  end
+
   it "sets strings correctly" do
     set("hello", "world")
     expect(get("hello")).to eq("world")
@@ -46,4 +50,11 @@ describe PluginStore do
     # ensure indiff access holds
     expect(result[:hi]).to eq("there")
   end
+
+  it "removes correctly" do
+    set("hello", true)
+    remove_row("hello")
+    expect(get("hello")).to eq(nil)
+  end
+
 end

From dfa6960799155bd201ee26475002b77fb49b4c4f Mon Sep 17 00:00:00 2001
From: Erik Ordway <ordwaye@evergreen.edu>
Date: Tue, 25 Feb 2014 08:26:35 -0800
Subject: [PATCH 2/2] clean up plugin store when removing data instead of
 setting the value to nil and do it a reasonable way.

---
 app/models/plugin_store.rb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/app/models/plugin_store.rb b/app/models/plugin_store.rb
index dab22ad8f..0c31d02fd 100644
--- a/app/models/plugin_store.rb
+++ b/app/models/plugin_store.rb
@@ -23,9 +23,7 @@ class PluginStore
   end
 
   def self.remove(plugin_name, key)
-    if row = PluginStoreRow.where(plugin_name: plugin_name, key: key).first
-      row.destroy
-    end
+    PluginStoreRow.where(plugin_name: plugin_name, key: key).destroy_all
   end