]> projects.mako.cc - selectricity-live/blobdiff - app/models/election.rb
fixed the string modification function and added support for a titlecase method
[selectricity-live] / app / models / election.rb
index 0860a426ff137d84dc9184ac322725aec05553cf..eaf07276128b3b8b8271646aabc6f936949a9ebb 100644 (file)
@@ -44,4 +44,12 @@ class Election < ActiveRecord::Base
     quickvote.to_i == 1
   end
 
+  def shortdesc
+    shortdesc = description.split(/\n/)[0]
+  end
+
+  def longdesc
+    longdesc = description.split(/\n/)[1..-1].join("")
+    longdesc.length > 0 ? longdesc : nil 
+  end
 end

Benjamin Mako Hill || Want to submit a patch?