Find_by_contents never finds anything on my model

Hi,
Let me preface by saying I am very new to ferret and aaf.

Anyhow, I’m using the aaf plugin on a model named Book. This model isnt
a typical rails model in the fact that it doesnt have an “id” column as
its primary key but instead has a string column named ISBN that is used
as the primary key. When I try to search for anything in the model
using find_by_contents it never finds anything. Trying to troubleshoot,
I added an id column in my model as an integer and made it auto
increment. Once I added this, added my sample data back in, and rebuilt
my index, I noticed that I could search all of a sudden using
find_by_contents. I changed it back again, and then my searches had no
results. I was wondering if there is anything to get it to work without
having to add an id field to my model?

Many thanks for your help in advance!
-Chris

On Tue, Nov 28, 2006 at 09:03:20AM +0100, Chris W. wrote:

my index, I noticed that I could search all of a sudden using
find_by_contents. I changed it back again, and then my searches had no
results. I was wondering if there is anything to get it to work without
having to add an id field to my model?

This should be possible, but not without modifying aaf. Aaf relies on
your model having an ‘id’ attribute in several places, if you changed
these places to use ‘isbn’ instead this should work.

Maybe one even could solve this in a more generic way by getting the
information what the actual primary key of the table is from active
record.

Anyway, the easiest way seems to rename your isbn column to ‘id’ would
be the easiest way :wink:

cheers,
Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66