In ActiveRecord, how to get the name of primary key(s)?

activerecord, ruby-on-rails

Solution

You can call `YourModel.arel_table.primary_key.name`. Or better yet, `YourModel.primary_key`.

Problem

With `DataMapper` i can iterate through properties and select one(s) of type `Serial`. Any straightforward way to do this in `ActiveRecord`?

Original source