Me again... I suppose Ruby is doing the RIGHT thing by returning null
on content_columns call since the child doesn't have any content per
se - it just holds two foreign keys. So maybe I can restate my Q...
How do I get at a parent of WantedOffer in this type of call? <% for
column in WantedOffer.content_columns %>
I'm not sure that rendering for .content_columns is something you'd
want to do in production. It may get things out quickly for
development but I'd suspect you will quickly want more control that
what that will allow.
As to your real question... I'm making an assumption from the keys in
your wanted_offers db that you might be able to build your classes
like this:
class User
has_many :wanted_offers
has_many :wanted_books :through=>:wanted_offers, :class_name=>'Book',
...
end
(You should mirror this in Book)
With that in place you should be able to do something like this:
@user.wanted_books.each do |book|
book.content_columns.each do |book_column|
...whatever it is you were trying to do...
end
end