Ruby-on-rails: getting database unique id


I have a simple model, Post with title and content.

I'm trying to link Post & Users together by the post unique_id and the user unique_id

In the course of my testing I've noticed that object_id is not the unique id of the record in the database. It changes with every page refresh.

My schema does not explicitly state the need for a unique id since I thought that attribute was automatically generated.

So, should i change my schema to have a unique id or can I access it through another method?

Best Solution

Is this a trick question? You have and (Don't use post.object_id - maybe you were confused by that.)