X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/9abed97635edbac7fb1a687298fff5c5434cdff4..fc0a6a8d7ea15bcdb27ebdd58721401c7045c6e0:/app/models/ranking.rb diff --git a/app/models/ranking.rb b/app/models/ranking.rb old mode 100644 new mode 100755 index f24f0f9..5ef0575 --- a/app/models/ranking.rb +++ b/app/models/ranking.rb @@ -1,4 +1,14 @@ class Ranking < ActiveRecord::Base belongs_to :candidate belongs_to :vote + acts_as_list :scope => :vote, :column => :rank + + def <=>(other) + self.rank <=> other.rank + end + + def to_s + self.rank.to_s + end + end