While working with the ActiveRecord method ‘new_record?’ and Transactions I ran into an odd issue after I had run a few objects through a Transaction. Although the transaction had rolled back and thus not saving the record, running ‘object_instance.new_record?’ resulted in a return of false as if the record had been saved to the database. I also found the same issue recorded here: http://squarewheel.wordpress.com/2008/06/11/new_record/ Here is example code where the error will happen.

Continue reading

TLDR; Don’t store Tweet ID’s as INT. Use BIGINT. While writing a Twitter application in Rails I was having an issue saving tweets to the database. A quick brief on the application: The app would download tweets from the mention timeline of a particular user. It would only download tweets it hadn’t already processed based on the last saved tweets unique id (as set by twitter). All the data from the tweets were making it into the database as expected but every time the application downloaded tweets it would re-download the same tweets.

Continue reading

Author's picture

Brian Pearce

Software Developer, Endurance Cyclist,
Rubiest, Rustacean, and Gopher

Software Engineer

Barcelona, Spain