1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-05-06 14:33:14 +00:00

Changed tournament.matchups to tournament.matchups_array

This commit is contained in:
2015-03-25 00:49:23 +00:00
parent 0b4c9075b1
commit 862c69e431
3 changed files with 11 additions and 6 deletions

View File

@@ -4,15 +4,15 @@ class Tournament < ActiveRecord::Base
has_many :matches, dependent: :destroy has_many :matches, dependent: :destroy
has_many :mats, dependent: :destroy has_many :mats, dependent: :destroy
attr_accessor :upcomingMatches, :unfinishedMatches attr_accessor :upcomingMatches, :unfinishedMatches
serialize :matchups serialize :matchups_array
def unfinishedMatches def unfinishedMatches
end end
def upcomingMatches def upcomingMatches
if self.matchups? if self.matchups_array?
return self.matchups return self.matchups_array
else else
@upcomingMatches = generateMatchups @upcomingMatches = generateMatchups
return @upcomingMatches return @upcomingMatches
@@ -33,7 +33,7 @@ class Tournament < ActiveRecord::Base
@upcomingMatches = weight.generateMatchups(@matches) @upcomingMatches = weight.generateMatchups(@matches)
end end
@upcomingMatches = assignBouts(@upcomingMatches) @upcomingMatches = assignBouts(@upcomingMatches)
self.matchups = @upcomingMatches self.matchups_array = @upcomingMatches
self.save self.save
return @upcomingMatches return @upcomingMatches
end end

View File

@@ -0,0 +1,5 @@
class RenameTournamentMatchups < ActiveRecord::Migration
def change
rename_column :tournaments, :matchups, :matchups_array
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150324233726) do ActiveRecord::Schema.define(version: 20150325004527) do
create_table "matches", force: :cascade do |t| create_table "matches", force: :cascade do |t|
t.integer "r_id" t.integer "r_id"
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20150324233726) do
t.string "director_email" t.string "director_email"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.text "matchups" t.text "matchups_array"
end end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|