Displaying 1 result from an estimated 1 matches for "reports_sort".
Did you mean:
reports_sorts
2006 Feb 28
8
HABTM count table
...s_to_many :reports
end
class Report < ActiveRecord::Base
has_and_belongs_to_many :region
has_and_belongs_to_many :subjects
has_and_belongs_to_many :sorts
end
And i would like to get a count like
@sort.reports.count
The problem is get this query:
SELECT COUNT(*) FROM reports WHERE (reports_sorts.sort_id = 6003 )
He uses the wrong table "reports" instead of the join table
"reports_sorts". But it is in the where clause.
Thanks in advance,
Martijn