I am trying to use pagniate as follows:
@merch_pages, @merch = paginate :merch_item, :per_page => 15, :include
:merch_formats, :conditions => [“active_status = 1 AND format_name = ?”,
My ‘merch_item’ model contains a ‘has_many :merch_formats’.
active_status and format_name are defined on merch_format, not
The problem is that the SQL generated isn’t including merch_formats, it
SELECT COUNT(*) FROM merch_items WHERE (active_status = 1 AND
This of course fails, as the required JOIN wasn’t inserted.
Based on the paginate documentation, it seems that :include should work
same way that it does during a normal find.
What am I doing wrong?