mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
config.load_defaults is now 7.1 and I had to add optional belongs to to a couple models as a deprecation from the 4.2 to 5.0 upgrade
This commit is contained in:
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Mat < ActiveRecord::Base
|
||||
class Mat < ApplicationRecord
|
||||
belongs_to :tournament
|
||||
has_many :matches
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Match < ActiveRecord::Base
|
||||
class Match < ApplicationRecord
|
||||
belongs_to :tournament, touch: true
|
||||
belongs_to :weight, touch: true
|
||||
belongs_to :mat, touch: true
|
||||
belongs_to :mat, touch: true, optional: true
|
||||
has_many :wrestlers, :through => :weight
|
||||
has_many :schools, :through => :wrestlers
|
||||
validate :score_validation, :win_type_validation, :bracket_position_validation, :overtime_type_validation
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class School < ActiveRecord::Base
|
||||
class School < ApplicationRecord
|
||||
belongs_to :tournament, touch: true
|
||||
has_many :wrestlers, dependent: :destroy
|
||||
has_many :deductedPoints, class_name: "Teampointadjust"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class SchoolDelegate < ActiveRecord::Base
|
||||
class SchoolDelegate < ApplicationRecord
|
||||
belongs_to :school
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Teampointadjust < ActiveRecord::Base
|
||||
belongs_to :wrestler, touch: true
|
||||
belongs_to :school, touch: true
|
||||
class Teampointadjust < ApplicationRecord
|
||||
belongs_to :wrestler, touch: true, optional: true
|
||||
belongs_to :school, touch: true, optional: true
|
||||
|
||||
after_save do
|
||||
advance_wrestlers_and_calc_team_score
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Tournament < ActiveRecord::Base
|
||||
class Tournament < ApplicationRecord
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :user, optional: true
|
||||
has_many :schools, dependent: :destroy
|
||||
has_many :weights, dependent: :destroy
|
||||
has_many :mats, dependent: :destroy
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class TournamentDelegate < ActiveRecord::Base
|
||||
class TournamentDelegate < ApplicationRecord
|
||||
belongs_to :tournament
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
has_many :tournaments
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Weight < ActiveRecord::Base
|
||||
belongs_to :tournament
|
||||
class Weight < ApplicationRecord
|
||||
belongs_to :tournament, touch: true
|
||||
has_many :wrestlers, dependent: :destroy
|
||||
has_many :matches, dependent: :destroy
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Wrestler < ActiveRecord::Base
|
||||
class Wrestler < ApplicationRecord
|
||||
belongs_to :school, touch: true
|
||||
belongs_to :weight, touch: true
|
||||
has_one :tournament, through: :weight
|
||||
|
||||
Reference in New Issue
Block a user