I have a web application with users and their documents. Each user can have many documents:
user.rb:
has_many :documents
document.rb:
belongs_to :user
document_controller.rb:
def index
@documents = Document.find(:all)
end
I am using the restful_authentication plugin. Here is my question: how to make the controller display only documents belonging to each user? Now it displays all documents for all users.
I am using the latest version of Rails.
source
share