I have post and user model and I have Many(posts) to One(User) association.
I want to display only the posts which are created by that user(current user).
So somehow I have to inject the currently logged in user’s id into the “user_id” foreign key
of the post model during creation. I’m using Devise as my authentication system.
Any solutions of how to achieve this ?
I’m using Rails version 3.0.
Thanks in advance.
With devise simply use the “current_user” helper 😉