mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 01:11:23 +00:00
4199062a9c
Added model annotations
27 lines
486 B
Ruby
27 lines
486 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: gather_maps
|
|
#
|
|
# id :integer not null, primary key
|
|
# gather_id :integer
|
|
# map_id :integer
|
|
# votes :integer
|
|
#
|
|
|
|
class GatherMap < ActiveRecord::Base
|
|
scope :ordered, :order => "votes DESC, id DESC"
|
|
|
|
belongs_to :gather
|
|
belongs_to :map
|
|
has_many :real_votes, :class_name => "Vote", :as => :votable
|
|
|
|
before_create :init_variables
|
|
|
|
def to_s
|
|
self.map.to_s
|
|
end
|
|
|
|
def init_variables
|
|
self.votes = 0
|
|
end
|
|
end
|