I’ve been trying to use Rails on a database where the biggest
datawarehouse-style table doesn’t have a primary key. It really
doesn’t make sense and just adds extra unnecessary space. I do have,
however, a column that I normally use to search on (IP) that returns
many rows. The table also references several other tables through
rails-friendly foreign keys.
Simple AR works just fine but I’ve been running into trouble with more
advanced stuff and I’m not sure how to get around it. My biggest
problem is that the :include directive to find (to enable eager
associations) fails because it assumes that there is an ID field
present and tries to select it in the join. Similarly, the paginate
helper attempts to SELECT COUNT(DISTINCT mytable.id) when it is trying
to get the number of results of the query and bombs.
I have read all the legacy docs that I can find, but none seem to
address the issue of a non-existant primary key. Is there anything
that I missed?
Is there any way to fix the above problems?