Hi, im new to RoR so sorry if the questions sounds stupid to you. Im trying to build a tool for a browsergame. The game allows access to its database and the db looks like this: table villages: `id` int(9) unsigned NOT NULL default ''0'', `x` smallint(3) NOT NULL default ''0'', `y` smallint(3) NOT NULL default ''0'', `tid` tinyint(1) unsigned NOT NULL default ''0'', `vid` int(9) unsigned NOT NULL default ''0'', `village` varchar(20) NOT NULL default '''', `uid` int(9) NOT NULL default ''0'', `player` varchar(20) NOT NULL default '''', `aid` int(9) unsigned NOT NULL default ''0'', `alliance` varchar(8) NOT NULL default '''', `population` smallint(5) unsigned NOT NULL default ''0'', UNIQUE KEY `id` (`id`) the contents of the db is a map of the game with villages in it where one player (identified by his uid) may have several villages. i have a usertable that looks like this: table players: `id` int(9) unsigned NOT NULL default ''0'', `username` varchar(20) NOT NULL default '''', `password` varchar(20) NOT NULL default '''', `uid` int(9) NOT NULL default ''0'', (where uid is the userid in the game) i want to build a association betwen one user and his villages: class Village < ActiveRecord::Base belongs_to :player, :foreign_key => ''uid'' # doesnt seem to work end class Player < ActiveRecord::Base has_many :villages, :foreign_key => ''uid'' end The problem im having is that rails tries to match the villages by the id of the table players on not the uid and i dont know how to tell rails to not use the id but uid instead. Any ideas? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---