get data from multiple models

Hi all,

I have a model Post and a model User. The post has a user_id foreign
key. What is the best way (railsway) to get all the posts from 1 user?
Like
user = User.find(id)
posts = user.Node.find()

This doesn't work?

Thank,
Stijn

Tarscher wrote:

Hi all,

I have a model Post and a model User. The post has a user_id foreign
key. What is the best way (railsway) to get all the posts from 1 user?
Like
user = User.find(id)
posts = user.Node.find()

user has_many :posts
post belongs_to :user

user = User.find(id)
posts = user.posts