Displaying 1 result from an estimated 1 matches for "portfolio_list".
2006 Mar 03
5
avoiding nil object error?
...d::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :portfolios
end
In the controller i define a list of active portfolios:
@active_portfolios = Portfolio.find_all_by_is_active("1")
In the view i render the list of portfolios:
<%= render :partial => "portfolio_list", :collection =>
@active_portfolios %>
in the partial collection _portfolio_list i need to get the
image_url of the first image of the portfolio:
<td class="col1"><img src="<%= portfolio_list.images[0].image_url -%
>" /></td>
This work...