I have a model in which allows a user to create many of. I want only the user to see these objects if they are logged in. So as of now I have the object belongs_to:user and user has_many:objects set, but how do I set the user property when an object is created. I basically want the user to create this and then later on display all of them back using object find(where user=current_user).
I have a model in which allows a user to create many of. I
Share
In your objects_controller.rb create action do this:
Instead of:
To retrieve the current user’s objects, simply: