So in my model, there is a field user_id – which holds the ID of the user who created the record. To display the ID of the current user, I have @current_user.id
My question is this, in the controller I want @posts to only have records created by @current_user.id
how can I do this?
Assuming that
user has_many posts, you can do this: