Displaying 1 result from an estimated 1 matches for "find_all_by_is_active".
2006 Mar 03
5
avoiding nil object error?
...th one (prolly very silly) problem:
I have a table portfolios that has many images:
class Portfolio < ActiveRecord::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&q...