Displaying 1 result from an estimated 1 matches for "find_or_create_by_cod".
Did you mean:
find_or_create_by_code
2006 Aug 02
1
ActiveRecord: find_or_create with has_and_belongs_to_many --
I am attempting to use find_or_create on a foreign table with a
has_and_belongs_to_many relationship with my current table. I am doing
the following:
term = school.terms.find_or_create_by_code("FALL06")
the queries in the log show the expected SELECT statement to query if
there is a join table record between the school and term with code
"FALL06":
SELECT * FROM term
INNER JOIN school_term ON term.id = school_term.term_id
WHERE (school_term.school_id = 1 )
AND (...