[Rails] activerecord - finding parent info..

Jeffrey Hardy
2006-07-05T17:54:30Z

On 5-Jul-06, at 1:28 PM, sergio ruiz wrote:
> is there a one liner that would give me the data?

Assuming your models are wired up like so:

class Podcast < ActiveRecord::Base
   has_many :episodes
end

class Episode < ActiveRecord::Base
   belongs_to :podcast
end

You''d be able to do this:

e = Episode.find(1)
e.podcast


/Jeff