Displaying 1 result from an estimated 1 matches for "testdoneright_test".
2008 Jul 01
6
validates_associated & foreign keys
...ket record and (deliberately) enter
an area_code_id or a market_id that is incorrect, Ruby on Rails
doesn''t flag the error.
Instead I get an activerecord error on my foreign key constraint.
ActiveRecord::ActiveRecordError: Cannot add or update a child row: a
foreign key constraint fails
(`TestDoneRight_test`.`area_codes_markets`, CONSTRAINT
`area_codes_markets_ibfk_2` FOREIGN KEY (`area_code_id`) REFERENCES
`area_codes` (`id`)): INSERT INTO `area_codes_markets`
(`area_code_id`, `market_id`) VALUES(2, 1)
Reading the forums and the documentation, I think I have the correct
naming convention and model....