lib/activerecord_snapshot_view/snapshot_view.rb
# make the working table temporarily active [ for this thread only ], 
# execute the block, and if completed without exception then
# make the working table permanently active
make the working table temporarily active [ for this thread only ],
execute the block, and if completed without exception then
make the working table permanently active
make the working table temporarily active [ for this thread only ] execute the block and if completed without exception then make the working table permanently active
def new_version(&block)
        begin
          self.active_working_table_name = working_table_name
          ensure_version_table(working_table_name)
          connection.execute("truncate table #{working_table_name}")
          r = block.call
          advance_version
          r
        rescue SaveWork => e
          advance_version
          raise e 
        ensure
          self.active_working_table_name = nil
        end
      end
def new_version ( & block ) begin self . active_working_table_name = working_table_name ensure_version_table ( working_table_name ) connection . execute ( "truncate table #{working_table_name}" ) r = block . call advance_version r rescue SaveWork => e advance_version raise e ensure self . active_working_table_name = nil end end
make the working table temporarily active [ for this thread only ],
execute the block, and if completed without exception then
make the working table permanently active
make the working table temporarily active [ for this thread only ] execute the block and if completed without exception then make the working table permanently active
# raise the SaveWork again, in case we are inside nested new_versions
block