diff --git a/app/models/tournament.rb b/app/models/tournament.rb index e77e86a..7134ddd 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -4,15 +4,15 @@ class Tournament < ActiveRecord::Base has_many :matches, dependent: :destroy has_many :mats, dependent: :destroy attr_accessor :upcomingMatches, :unfinishedMatches - serialize :matchups + serialize :matchups_array def unfinishedMatches end def upcomingMatches - if self.matchups? - return self.matchups + if self.matchups_array? + return self.matchups_array else @upcomingMatches = generateMatchups return @upcomingMatches @@ -33,7 +33,7 @@ class Tournament < ActiveRecord::Base @upcomingMatches = weight.generateMatchups(@matches) end @upcomingMatches = assignBouts(@upcomingMatches) - self.matchups = @upcomingMatches + self.matchups_array = @upcomingMatches self.save return @upcomingMatches end diff --git a/db/migrate/20150325004527_rename_tournament_matchups.rb b/db/migrate/20150325004527_rename_tournament_matchups.rb new file mode 100644 index 0000000..ec0f6e2 --- /dev/null +++ b/db/migrate/20150325004527_rename_tournament_matchups.rb @@ -0,0 +1,5 @@ +class RenameTournamentMatchups < ActiveRecord::Migration + def change + rename_column :tournaments, :matchups, :matchups_array + end +end diff --git a/db/schema.rb b/db/schema.rb index 7cc747e..79e0e4b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.integer "r_id" @@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20150324233726) do t.string "director_email" t.datetime "created_at" t.datetime "updated_at" - t.text "matchups" + t.text "matchups_array" end create_table "users", force: :cascade do |t|