Class: SimulatorPlayer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SimulatorPlayer
- Defined in:
- app/models/simulator_player.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.dump! ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/models/simulator_player.rb', line 27 def self.dump! SimulatorTeam.all.each do |team| FootStats::Player.all(team: team.source_id).each do |foot_stats_player| player = self.find_or_create_by_source_id foot_stats_player.source_id player.update_attributes foot_stats_player.attributes.merge(simulator_team_id: team.id) end end end |
.to_foot_stats ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/simulator_player.rb', line 12 def self.to_foot_stats # FootStats suck! # Yes, it's stupid, but it's true... # FootStats doesn't return a collection on this... if count == 0 nil else if count == 1 self.first.to_foot_stats else { 'Jogador' => all.map(&:to_foot_stats) } end end end |
Instance Method Details
#to_foot_stats ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/models/simulator_player.rb', line 4 def to_foot_stats { '@Id' => self.source_id, '@Nome' => self.full_name, '@Apelido' => self.nickname } end |