Drowning in underscores and foreign keys

First off: Did you have a typo when saying: "s a pointer to the COMMUNITY_TYPE_TABLE, which has a COMMUNITY_TYPE_ID as its primary key, as well as a string COMMUNITY_TYPE_TABLE." did you mean "as a string "COMMUNITY_TYPE_TITLE" ? cos i never saw that title you refer to later anywhere in that explenation

Second: I'm pretty new to this stuff myself, so i just throw in my 2 cents, no promise it will work:

Tird: try this:

class CommunityType < ActiveRecord::Base   set_table_name "COMMUNITY_TYPE_TABLE"   set_primary_key "COMMUNITY_TYPE_ID"

  has_many :communities, :foreign_key => "community_type_id"


class Community < ActiveRecord::Base   set_table_name "COMMUNITY_TABLE"   set_primary_key "COMMUNITY_ID"

  belongs_to :community_type, :foreign_key => "community_type_id" end

i'm not sure if you have to specify :foregn_key in the belongs_to, but for sure in the has_many, cos otherwise Rails would assume that the foreign_key in the COMMUNITY_TABLE would be the primary key "community_id", but its "community_table_id"

... or i got you wrong or all twisted up :smiley: Give it a shot.