I have a Users table which has both belongs_to and habtm relationships with Messages. I have set the appropriate class names, and association keys, since I am dealing with a legacy database. Messages: belongs_to :sender has_and_belongs_to_many :receivers When I try to use eager loading with: :include => [:receivers, :sender] I get the following error: Not unique table/alias: ''users'' Having dug through the api I can not find a way to assign an alias for the joins. Do I have to fallback to using old fashioned SQL finders? -- Lon Baker Speedymac LLC http://www.speedymac.com AIM: spdemac Skype: spdemac
On Friday 05 August 2005 20:14, Lon Baker wrote:> I have a Users table which has both belongs_to and habtm > relationships with Messages. I have set the appropriate class names, > and association keys, since I am dealing with a legacy database.Doesn''t work currently. I''ve submitted a patch that aliases tables to make this case and others possible. http://dev.rubyonrails.org/ticket/1907 I sure hope anyone of the committers has a look and applies it. Michael -- Michael Schuerig Failures to use one''s frontal lobes mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org can result in the loss of them. http://www.schuerig.de/michael/ --William H. Calvin