Is it really no way to switch on eager loading for sccotioations??
I could not beleive that ActiveRecord have no solutions for it...
On 11/8/05, Anatol Pomozov
<anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> 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
--
anatol
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails