to_formatted_s will convert an array of objects to a form usable by a database; I'm guessing from the code that this supposed to be used to put a number of ActiveRecord objects into a sequence for insertion.
This patch checks the type of these objects, because if they are not ActiveRecord objects, Ruby warns that id is deprecated and that you should be using object_id. The patch's behavior makes it where if it is an ActiveRecord object, then it inserts it as the id attribute; otherwise, the object is inserted as its string representation.