Skip to content
Browse files

remove fake AR models

  • Loading branch information...
1 parent d3fa6fb commit 335abf7631ae81fde333ded65bf7770e6d2536ee = committed Nov 30, 2010
Showing with 2 additions and 62 deletions.
  1. +0 −8 app/models/alliance_member.rb
  2. +0 −27 app/models/enum_class.rb
  3. +2 −18 app/models/game_player.rb
  4. +0 −9 app/models/tribe.rb
View
8 app/models/alliance_member.rb
@@ -1,8 +0,0 @@
-class AllianceMember < EnumClass
-
- MEMBER = new(:id => 1, :pretty_name => 'Member')
- NON_MEMBER = new(:id => 2, :pretty_name => 'Non-Member')
-
- ALL = [MEMBER, NON_MEMBER]
-
-end
View
27 app/models/enum_class.rb
@@ -1,27 +0,0 @@
-class EnumClass
-
- def initialize(attributes)
- @attributes = attributes
- end
-
- def id
- @attributes[:id]
- end
-
- def pretty_name
- @attributes[:pretty_name]
- end
-
- ###
- # Class Methods
- ###
-
- def self.all
- self::ALL
- end
-
- def self.find(id)
- self::ALL.select { |a| a.id == id }
- end
-
-end
View
20 app/models/game_player.rb
@@ -2,24 +2,8 @@ class GamePlayer < ActiveRecord::Base
belongs_to :game
belongs_to :player
- # belongs_to :tribe
- # belongs_to :alliance_member
-
- ###
- # Fake Associations
- ###
-
- def tribe
- Tribe.find(self.tribe_id)
- end
-
- def alliance_member
- AllianceMember.find(self.alliance_member_id)
- end
-
- ###
- # Other Methods
- ###
+ belongs_to :tribe
+ belongs_to :alliance_member
def pretty_name
self.travian_username || "#{self.class.to_s} ##{self.id}"
View
9 app/models/tribe.rb
@@ -1,9 +0,0 @@
-class Tribe < EnumClass
-
- TEUTONS = new(:id => 1, :pretty_name => 'Teutons')
- GAULS = new(:id => 2, :pretty_name => 'Gauls')
- ROMANS = new(:id => 3, :pretty_name => 'Romans')
-
- ALL = [TEUTONS, GAULS, ROMANS]
-
-end

0 comments on commit 335abf7

Please sign in to comment.
Something went wrong with that request. Please try again.