spec/dummy_app/db/seeds.rb in rails_admin-0.6.3 vs spec/dummy_app/db/seeds.rb in rails_admin-0.6.4
- old
+ new
@@ -16,10 +16,10 @@
unless division = division_model.where(name: mlb_team.division).first
division = division_model.model.new(name: mlb_team.division, league: league)
division.save!
end
unless team = team_model.where(name: mlb_team.name).first
- team = team_model.model.new(name: mlb_team.name, logo_url: mlb_team.logo_url, manager: mlb_team.manager, ballpark: mlb_team.ballpark, mascot: mlb_team.mascot, founded: mlb_team.founded, wins: mlb_team.wins, losses: mlb_team.losses, win_percentage: (format('%.3f', (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses)))).to_f, division: division)
+ team = team_model.model.new(name: mlb_team.name, logo_url: mlb_team.logo_url, manager: mlb_team.manager || 'None', ballpark: mlb_team.ballpark, mascot: mlb_team.mascot, founded: mlb_team.founded, wins: mlb_team.wins, losses: mlb_team.losses, win_percentage: (format('%.3f', (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses)))).to_f, division: division)
team.save!
end
mlb_team.players.reject { |player| player.number.nil? }.each do |player|
player_model.model.new(name: player.name, number: player.number, position: player.positions.first, team: team).save
end