nil.each error

When I run the following code in the console I get the following error:

s_date = Date.new(2007,6,3)
e_date = Date.new(2007,7,3)

due_dates = DueDate.find(:all, :conditions => ['stamp >= ? and stamp <=
?',s_date.to_s(:db),e_date.to_s(:db)], :order => 'stamp desc')

sales_orders = []

due_dates.each { |dd| sales_orders << dd.so_number }

@histories = History.find_by_sales_orders(sales_orders)

@histories.compact!.each { |history|

Get rid of the '!'.

Hi --