Queries generated by various methods in target_list do not seem to see
the
foreign_key name and keep trying to query my Target table using
“target_list_id” (the default foreign key).
Queries generated by various methods in target_list do not seem to see
the
foreign_key name and keep trying to query my Target table using
“target_list_id” (the default foreign key).
Anyone seen this before?
Wes
To be more specific, in target_list.rb, I’m doing targets.size to get
the count of my child object, targets.
The query that’s generated correctly goes against the right table, but
the foreign_key specified is default.
I’m trying to puzzle through the ActiveRecord code on my own but it’s
pretty brutal. Here’s some more info.
I’ve discovered that by the time I get into the has_many_association.rb
count_records method, already the counter_sql is incorrect. In fact
when the has_many association is initialized, this SQL is incorrect.
I think that there may be an issue with the fact that both of my tables
(parent AND child) do a set_primary_key - I think that maybe
ActiveRecord can’t handle it.
And sadly, I don’t have any more time to figure out how this all works.
I’ll write a custom finder to do the <child_table>.size query. Sigh.