ensl.org/app/models/gather_map.rb

28 lines
490 B
Ruby
Raw Normal View History

# == Schema Information
#
# Table name: gather_maps
#
# id :integer not null, primary key
# gather_id :integer
# map_id :integer
# votes :integer
#
class GatherMap < ActiveRecord::Base
2019-06-02 01:26:36 +00:00
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
2019-08-14 06:30:56 +00:00
end
def init_variables
self.votes = 0
end
end