It seems that the method “bio” is not being recognized in the Employee
Class. Period.
To test this, I tried @employees.bio.each do |bio|, and it also gives me
the same message.
You misunderstood Ilan. bio is an instance method of an Employee
instance, not a method of the @employeescollection.
So you call .bio on each employee object individually, not on the
collection as a whole. To collect up all the bios for each employee,
you can do something like this in your controller:
Thanks! That does make sense, and I’ve been able to proceed a bit.
Although, in your example above: @bios = @category.employees.collect {
|employee| employee.bio } returns Employee records that do not have
bios, evidenced by some bio records returning nil.
I thought I’d be able to call something like: @category.employees.bio
and get the appropriate information.
If only certain employees have bios,
and employees belongs to categories
… I wanted to see only certain bios belonging employees who belong to
1 category.
Thanks! That does make sense, and I’ve been able to proceed a bit.
Although, in your example above: @bios = @category.employees.collect {
|employee| employee.bio } returns Employee records that do not have
bios, evidenced by some bio records returning nil.
You can filter those out by calling .compact on the collectoin: