2014-03-26 11:09:39 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: gather_servers
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# gather_id :integer
|
|
|
|
# server_id :integer
|
|
|
|
# votes :integer
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
#
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
class GatherServer < ActiveRecord::Base
|
2020-03-16 20:57:41 +00:00
|
|
|
scope :ordered, -> { order("votes DESC") }
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2020-03-26 02:26:30 +00:00
|
|
|
belongs_to :gather, :optional => true
|
|
|
|
belongs_to :server, :optional => true
|
2014-03-23 00:22:25 +00:00
|
|
|
has_many :real_votes, :class_name => "Vote", :as => :votable
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
self.server.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def before_create
|
|
|
|
self.votes = 0
|
|
|
|
end
|
|
|
|
end
|