Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use sane variable names for AbstractModel instances

  • Loading branch information...
commit 0140447084d950a6a93f6374f30b7c1970e52855 1 parent 1c1a60b
@timkurvers timkurvers authored
Showing with 14 additions and 14 deletions.
  1. +14 −14 spec/dummy_app/db/seeds.rb
View
28 spec/dummy_app/db/seeds.rb
@@ -1,29 +1,29 @@
require 'mlb'
-AgnosticUser = RailsAdmin::AbstractModel.new(User)
-AgnosticLeague = RailsAdmin::AbstractModel.new(League)
-AgnosticDivision = RailsAdmin::AbstractModel.new(Division)
-AgnosticTeam = RailsAdmin::AbstractModel.new(Team)
-AgnosticPlayer = RailsAdmin::AbstractModel.new(Player)
+user_model = RailsAdmin::AbstractModel.new(User)
+league_model = RailsAdmin::AbstractModel.new(League)
+division_model = RailsAdmin::AbstractModel.new(Division)
+team_model = RailsAdmin::AbstractModel.new(Team)
+player_model = RailsAdmin::AbstractModel.new(Player)
-AgnosticUser.new(:email => 'username@example.com', :password => 'password', :password_confirmation => 'password').save
+user_model.new(:email => 'username@example.com', :password => 'password', :password_confirmation => 'password').save
MLB::Team.all.each do |mlb_team|
- unless league = AgnosticLeague.where(:name => mlb_team.league).first
- league = AgnosticLeague.new(:name => mlb_team.league)
+ unless league = league_model.where(:name => mlb_team.league).first
+ league = league_model.new(:name => mlb_team.league)
league.save
end
- unless division = AgnosticDivision.where(:name => mlb_team.division).first
- division = AgnosticDivision.new(:name => mlb_team.division, :league => league)
+ unless division = division_model.where(:name => mlb_team.division).first
+ division = division_model.new(:name => mlb_team.division, :league => league)
division.save
end
- unless team = AgnosticTeam.where(:name => mlb_team.name).first
- team = AgnosticTeam.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 => ("%.3f" % (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses))).to_f, :division => division)
+ unless team = team_model.where(:name => mlb_team.name).first
+ team = team_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 => ("%.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|
- AgnosticPlayer.new(:name => player.name, :number => player.number, :position => player.position, :team => team).save
+ player_model.new(:name => player.name, :number => player.number, :position => player.position, :team => team).save
end
end
-puts "Seeded #{AgnosticLeague.count} leagues, #{AgnosticDivision.count} divisions, #{AgnosticTeam.count} teams and #{AgnosticPlayer.count} players"
+puts "Seeded #{league_model.count} leagues, #{division_model.count} divisions, #{team_model.count} teams and #{player_model.count} players"
Please sign in to comment.
Something went wrong with that request. Please try again.