Ruby on Rails Thursday, March 12, 2015



On Wednesday, March 11, 2015 at 11:09:47 AM UTC, Ruby-Forum.com User wrote:

and when i run this , i've got an error : here is the logs :

PG::UndefinedColumn: ERREUR:  la colonne treatments.arch_information_id
n'existe pas
LINE 1: ..."treatments".* FROM "archive"."treatments"  WHERE
"archive"....
                                                             ^
: SELECT "archive"."treatments".* FROM "archive"."treatments"  WHERE
"archive"."treatments"."arch_information_id" IN ('1885320', '1885319',
'1885318', '1885317', '1885316', '1885315', '1885314', '1885313')



the error is obvious , when activeRecord build the request , he named my
foreign key "arch_information_id" instead of "information_id" like i
told him in my ArchTreatments class


The preload is going from  your ArchInformation to your archive_arch_treatments association - it is the foreign_key setting on this association that is used not the one "on the other side" (active record isn't smart enough to apply options from one to the other)

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/27db4a70-784c-4967-8098-ca5cc85ff0df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment