mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Trying to increase speed of up_matches
This commit is contained in:
@@ -2,6 +2,7 @@ class Match < ActiveRecord::Base
|
||||
belongs_to :tournament
|
||||
belongs_to :weight
|
||||
belongs_to :mat
|
||||
has_many :wrestlers, :through => :weight
|
||||
|
||||
after_save do
|
||||
if self.finished == 1
|
||||
@@ -30,6 +31,14 @@ class Match < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def wrestler1
|
||||
wrestlers.where(id: self.w1)
|
||||
end
|
||||
|
||||
def wrestler2
|
||||
wrestlers.where(id: self.w2)
|
||||
end
|
||||
|
||||
def w1_name
|
||||
if self.w1
|
||||
Wrestler.find(self.w1).name
|
||||
|
||||
Reference in New Issue
Block a user