search for: _undefined

Displaying 1 result from an estimated 1 matches for "_undefined".

Did you mean: undefined
2005 Apr 16
1
Accessor not set
...longs to one genre: class Band < ActiveRecord::Base belongs_to :genre end class Genre < ActiveRecord::Base has_many :bands end In the list.rhtml, when I do: <% for band in @bands %> <td><%=h band.genre.name%></td> </tr> <% end %> it gives me: _undefined method `name'' for nil:NilClass _When I do: band.genre.inspect I get: #<Genre:0x86fb610 @attributes={"name"=>"Rock", "id"=>"1"}> So the name attr is there. I just can''t access it because seemingly there''s no accessor....