[Rails] activerecord - finding parent info..

sergio ruiz
2006-07-05T17:28:28Z

i am SURE this is really simple.. and i am SURE i have read this a
million times.. but i am not wiring this up in my brain correctly..

if i have a parent class that has fields:

Podcasts
id
title
description

and a child class like:

Episodes
id
podcast_id
title
description
filename

i can get the episode information all day.. but using the "Episode"
class, can i access the "Podcast" class info?

for instance.. if i said:

@episode = Episodes.find(1)

and got the episode with id=1, can i also get the podcast info that is
referenced in with Podcast.find(@episode.podcast_id)

is there a one liner that would give me the data?

am i making sense?

thanks!

--
Posted via http://www.ruby-forum.com/.