If highlighting a certain item on the front page can be random, I would suggest a much easier solution (assuming your using MySQL, don’t know if the other DBMS support this):
@featured_blog = Blog.find(:first, :order => “RAND()”)
@featured_book = Book.find(:first, :order => “RAND()”)
Add conditions if you want to limit the number of records, e.g. @featured_blog = Blog.find(:first, :conditions => [“updated_at > ?”, Date.today.last_month], :order => “RAND()”)
This basically translates to “SELECT * FROM blogs LIMIT 1 ORDER BY RAND()”, it tells MySQL to fetch 1 single random record out of the resultset.
Peter De Berdt