0

I'm connecting my Rails application with a legacy database. Some of this tables don't have a primary key and I have no way to add one.

Is there any way to to configure an Active Model not to have a primary key?

Thanks!

1 Answers1

0

You can define primary key by using self.primary_key = <pk_field> like so:

class User < ActiveRecord::Base
    self.table_name = "user"
    self.primary_key = "id"
end
nayiaw
  • 1,416
  • 4
  • 17
  • 26