Re: undefined method & has_one

Ilan Berci
Wed, 01 Nov 2006 21:59:13 -0000

Ryan wrote:
d
>
>
> i''m trying to get a recordset of all the bios in a view using:
>
> @category.employees.bio each do |bio|
>
> ... but i am getting "undefined method `bio'' for
Employee:Class"
>
>
>
> @category.employees does return a valid recordset
>
>
>
> Any ideas?
>

in this case @category.employees is an array and doesn''t support the
method bio(), try: @category.employees.each {|emp| puts emp.bio}