Is there have any way can build one-to-many relationship without primary key

I have two models,Book and Picture,one book can have many pictures.
In database,I contact them by uuid column which is not a primary
key,roughly like this:

|--------------------------------- |-------------1:*(via
|id | title | isbn |…|uuid
| |id|create_at|rating|…|


you can use :foreign_key like
has_many :pictures, ::foreign_key => “uuid”
or if that doesn’t work you could use the :finder_sql option
and define you own sql to find the related records.

Yes, you can…

I’m doing some work with occupational data right now and everything
has an onet_soc_code which is not the primary key. It’s not
documented, but you can do this (primary_key tells the model to use
that column as the local side for looking things up instead of the
tables real primary key).

has_many :aliases,
:class_name => ‘OccupationAlias’,
:primary_key => :onet_soc_code,
:foreign_key => :onet_soc_code,
:order => ‘title’

Going the other way requires a patch to Rails, but lets you do this:

belongs_to :occupation,
:primary_key => :onet_soc_code,
:foreign_key => :onet_soc_code

The patch is here: