search for: name_common

Displaying 1 result from an estimated 1 matches for "name_common".

2006 Aug 02
1
ActiveRecord: find_or_create with has_and_belongs_to_many --
...R JOIN school_term ON term.id = school_term.term_id WHERE (school_term.school_id = 1 ) AND (term.`code` = ''FALL06'' ) LIMIT 1 but the INSERT behavior does not include a join table insert if the SELECT does not find an appropriate record: INSERT INTO term (`code`, `name_full`, `name_common`, `date_end`, `date_start`) VALUES(''FALL06'', NULL, NULL, NULL, NULL) I have resolved this by changing my original code to implement a uniqueness check in ruby: term = school.terms.find_or_create_by_code("FALL06") school.terms << term unless school.terms.any? do |...