hello list, weve got some tables of a earlier project, which have to integrate into rails. im now testing two tables. RailsModelName | DatabaseTableName | primary_key | foreign_key Advertiser INSERENT INSNR PrivProperty OBJPRIV RECCOU MAKNR so, i wrapped these settings in my model see below class Advertiser < ActiveRecord::Base self.table_name = "INSERENT" self.primary_key = "INSNR" has_many :priv_properties, :class_name => "PrivProperty", :foreign_key => "MAKNR" end class PrivProperty < ActiveRecord::Base self.table_name = "OBJPRIV" self.primary_key = "RECCOU" belongs_to :advertisers, :class_name => "Advertiser", :foreign_key => "MAKNR" end so, to test the current construct, i started ruby script/console ins = Advertiser.find(12345) #works well but ins.priv_properties # doesnt work -> i got a nil object the same with prop = PrivPropery.find(5678) prop.advertisers #-> nil object so, the development.log shows me the generated sql ins.priv_properties produces SELECT * FROM OBJPRIV WHERE (OBJPRIV.MAKNR = NULL) # why NULL instead of the id? prop.advertisers doesnt generate a sql, instead, it get nil so why this relation doesnt work? are the names of has_many and belongs_to wrong? thanks for help best regards --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---