First, let me just say “YES, I KNOW, I SHOULD BE USING WILL PAGINGATE
INSTEAD”.
Now, with that out of the way, and assuming that I have some reason
(stubornness, laziness, whatever) to keep using paginate on this old
project in 1.2 rails…
I’m trying to set up my conditions with a “joins” parameter. I have a
join table which follows the active record expectation for a habtm
association, which is unfortunately inconsistent pluralization wise with
a regular table name. the join table is called “events_owners”, so it
is plural and that seems to screw things up with the conditions.
Here’s my code right now…
@events_for_reports_pages, @events_for_reports = paginate :events,
:joins => :events_owners,
:conditions => [ “events_owners.owner_id=?” , @owner.id ],
:order => :created_at,
:per_page => 50
Here’s the error I get back:
Mysql::Error: Unknown column ‘events_ownerss.owner_id’ in ‘where
clause’: SELECT count(*) AS count_all FROM events events_owners WHERE
(events_ownerss.owner_id=1)
Any ideas? I think it is because the events_owners table is pluralized,
where as a normal table isn’t, but maybe it is something else.
thanks,
jp