here is the situation class Entity < ActiveRecord::Base belongs_to :parent, :foreign_key => :parent_id, :class_name => 'Entity' end
class Player < Entity end class Team < Entity has_many :players, :foreign_key => :parent_id, :class_name => 'Player' end class Club < Entity has_many :teams, :foreign_key => :parent_id, :class_name => 'Team' has_many :players, :through => :teams, :foreign_key => :parent_id, :class_name => 'Player' end Mysql::Error: Not unique table/alias: 'entities': SELECT count(*) AS count_all FROM `entities` INNER JOIN `entities` ON `entities`.parent_id = `entities`.id WHERE ((`entities`.parent_id = 48) AND (( (`entities`.`entity_type` = 'Team' ) ))) AND ( `entities`.`entity_type` = 'Player' ) how do get over this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

