Filtering records in controller

Posted by Elliot on Stack Overflow See other posts from Stack Overflow or by Elliot
Published on 2010-04-22T02:01:50Z Indexed on 2010/04/22 5:03 UTC
Read the original article Hit count: 232

Filed under:

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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails