Example using uncached

I am inserting rows into a MS SQL Server table from a Rails 2.0 application. However, when ActiveRecord issues a "SELECT @@IDENTITY AS Ident" after each insert, it only ever returns the values of the initial SELECT. (The log shows it's hitting cache.)

Is this the proper way to disable caching for these inserts?

    files.each do |f|       ActiveRecord::Base.connection.uncached do         self.items.create!(:file => f) unless f.blank?       end     end