Sha256: 6e6c83d3a91a5135976fac768968e437910616cad11d0a73766bc1b21fa21d0f
Contents?: true
Size: 763 Bytes
Versions: 1
Compression:
Stored size: 763 Bytes
Contents
class Match < ActiveRecord::Base self.primary_key = 'id' has_one :winner, :foreign_key => "player_id", primary_key: "winner_id", class_name: "::Player" has_one :loser, :foreign_key => "player_id", primary_key: "loser_id", class_name: "::Player" (Constants::START_YEAR..Constants::END_YEAR).each do |year| scope "in_#{year}".intern, -> { where("extract(year from match_date)=#{year}") } end scope :slams, -> { where(tourney_level:'G') } scope :finals, -> { where(round:'F') } def players ::Player.where(player_id:[winner_id,loser_id]) end def self.select_compact select(:id, :tourney_id, :tourney_name, :surface, :tourney_level, :round, :minutes, :winner_id, :winner_name, :loser_id, :loser_name, :score) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
atpruby-0.1.2 | lib/atpruby/match.rb |