Hi, All.
I have following model.
Category has_many_and_belongs to Property. Property belongs_to Term.
In controller i receive category_id from user. I need to load for this
category all properties that belongs to Category with it’s term.
For now I have following code
@props = Category.find(@params[:selected_category]).properties
and in view
for each p in @props
<%p.term.name%>
but as I understand term not loaded in Category.find so <%p.term.name%>
throws “nil have no name method”. (p.term is nil)
So my question is simple how to load term during find.
Thanks for any response.
–
anatol