Add support for non-standard primary keys

Use the ```ActiveRecord``` ```primary_key``` method instead of hardcoding ```id```.