legacy database and rails with its auto incrementing primary key problems

I'm sorta stuck as to what to do.
I'm porting a legacy database where the primary key were not auto
incrementing fields.

An example

create_table: components do |t|
  t.integer :componentid
  ...
end

and

create_table: versions do |t|
  t.integer :versionid
  t.integer :componentid
  ...
end

The foreign key for table versions is componentid from table
components.
In MySQL, the primary key would be 'id', an auto incrementing field.
I would have liked to make componentid in components my primary key
but seems rails does not like non-auto incrementing primary keys...so
the question becomes how do I create the key relationship?
I would like to be make searches along the lines of
version=components.versions.versionid or some such. Am I making any
sense?

Thanks in advance,
Hubert