Fix bug when try to use primary key class instead relation primary key

When use self.primary_key different from "id", causes a ActiveRecord::StatementInvalid when try to update, create and destroy.