ensl.org/app/models/gather_server.rb
Luke Barratt 4199062a9c Initial article text code
Added model annotations
2014-03-26 11:09:39 +00:00

27 lines
507 B
Ruby

# == 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
#
class GatherServer < ActiveRecord::Base
scope :ordered, :order => "votes DESC"
belongs_to :gather
belongs_to :server
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