activerecord and composite keys

N

Nicolas Couturier

I'm using Dr Nic's composite keys gems.
I'm connected to an Oracle database. So far, so good.
I set up my models as such :

class Dossier < ActiveRecord::Base
set_table_name :dc_dossier
set_primary_key :n_dossier
has_many :dossier_personnes
end
class Dossier_Personne < ActiveRecord::Base
set_table_name :dc_dossier_personne
set_primary_keys :n_dossier, :n_personne
belongs_to :dossier, :foreign_key => :n_dossier
end

And tried that :
Dossier.find:)first).dossier_personnes

Got this error :
uninitialized constant Dossier::DossierPersonne (NameError)

I'm quite new to ruby, is there something that i'm doing wrong ?
Thanks in advance for your help.
 
J

Jean-François Trân

Nicolas :
class Dossier_Personne < ActiveRecord::Base
set_table_name :dc_dossier_personne
set_primary_keys :n_dossier, :n_personne
belongs_to :dossier, :foreign_key =3D> :n_dossier
end

And tried that :
Dossier.find:)first).dossier_personnes

Got this error :
uninitialized constant Dossier::DossierPersonne (NameError)

Maybe you should call your class DossierPersonne instead of
Dossier_Personne.

-- Jean-Fran=E7ois.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top