Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Commit

Permalink
fixup seeds, repair player_stats reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Collin committed Jan 22, 2012
1 parent f01f7b7 commit f6a740b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 4 additions & 1 deletion app/controllers/matches_controller.rb
Expand Up @@ -4,11 +4,14 @@ def index
end end


def new def new
@match = Match.new @season = Season.find(params[:season_id])
@match = @season.matches.build
end end


def create def create
@season = Season.find(params[:season_id])
@match = Match.new(params[:match]) @match = Match.new(params[:match])
@season.matches << @match


if @match.save if @match.save
#redirect_to matches_player_stats #redirect_to matches_player_stats
Expand Down
6 changes: 3 additions & 3 deletions app/views/matches/new.html.erb
@@ -1,12 +1,12 @@
<h1>Matches#new</h1> <h1>Matches#new</h1>


<%= form_for @match do |f| %> <%= form_for [@season, @match] do |f| %>
<%= errors_for @match %> <%= errors_for @match %>
<div class="span-24"> <div class="span-24">
<div class="span-12"> <div class="span-12">
<h2>Home</h2> <h2>Home</h2>
<p> <p>
<%= f.collection_select :home_team_id, Team.all, :id, :name, :prompt => true %> <%= f.collection_select :home_team_id, @season.teams, :id, :name, :prompt => true %>
</p> </p>
<hr> <hr>
<p> <p>
Expand All @@ -19,7 +19,7 @@
<div class="span-12 last"> <div class="span-12 last">
<h2>Away</h2> <h2>Away</h2>
<p> <p>
<%= f.collection_select :away_team_id, Team.all, :id, :name, :prompt => true %> <%= f.collection_select :away_team_id, @season.teams, :id, :name, :prompt => true %>
</p> </p>
<hr> <hr>
<p> <p>
Expand Down
5 changes: 4 additions & 1 deletion app/views/matches/show.html.erb
@@ -1,7 +1,10 @@
<h1>Matches#show</h1> <h1>Matches#show</h1>
<p>
<%= link_to 'back to season', season_path(@match.season) %>
</p>
<div class="span-24"> <div class="span-24">
<div class="span-12"> <div class="span-12">
<h2><%= @match.home_team.name %> <%= @match.away_team_score %></h2> <h2><%= @match.home_team.name %> <%= @match.home_team_score %></h2>
<hr> <hr>
<h3>Player Stats</h3> <h3>Player Stats</h3>
<table> <table>
Expand Down
8 changes: 4 additions & 4 deletions db/seeds.rb
Expand Up @@ -7,7 +7,7 @@
# Mayor.create(name: 'Emanuel', city: cities.first) # Mayor.create(name: 'Emanuel', city: cities.first)


league = League.create(name: 'TF2fpg') league = League.create(name: 'TF2fpg')
season = league.season.create(name: 'TF2fpg1') season = league.seasons.create(name: 'TF2fpg1')


frag = season.teams.create(name: 'Frag', tag: '`fp-') frag = season.teams.create(name: 'Frag', tag: '`fp-')
ruth = season.teams.create(name: 'Ruthless', tag: 'R7') ruth = season.teams.create(name: 'Ruthless', tag: 'R7')
Expand All @@ -16,6 +16,6 @@
frag.members.create(alias: 'coco') frag.members.create(alias: 'coco')
frag.members.create(alias: 'ricr') frag.members.create(alias: 'ricr')


ruth.members.create(alias: 'jesus') ruth.members.create(alias: 'blade')
ruth.members.create(alias: 'jesus') ruth.members.create(alias: 'idk')
ruth.members.create(alias: 'jesus') ruth.members.create(alias: 'again')

0 comments on commit f6a740b

Please sign in to comment.