]> projects.mako.cc - selectricity-live/blobdiff - app/models/quick_vote.rb
Merge jdong branch
[selectricity-live] / app / models / quick_vote.rb
index 6259784bfbaf1bc847ad8e67b6fad04a2722cf45..5f566c6eb1e6575e1f8f6a7845e67ba21d963c53 100644 (file)
@@ -74,4 +74,15 @@ class QuickVote < Election
 
 
   end
+
+  ### Convert a shortname or id into a QuickVote
+  def self.ident_to_quickvote(ident)
+    if ident.match(/^\d+$/)
+      quickvote = QuickVote.find(ident)
+    else
+      quickvote = QuickVote.find_all(["name = ?", ident])[0]
+    end
+
+    return quickvote
+  end
 end

Benjamin Mako Hill || Want to submit a patch?