In conjunction with my Physical Computing final, I made a website in Ruby / Sinatra for the Change You Can Believe In device.

Correctly formatting currency on a website is surprisingly difficult. My goal was to record change input from the machine and analyze and display it on the website. A library (Gem in Ruby terms) is available to help make that easier. However, the ITP server does not permit us to add them. So the adventure begins.

The Process

Setup Ruby & Sinatra locally: This let me develop the website on my own computer. Not only was this faster and more efficient than running things on the ITP server, it let me use the gem which made currency display easier. Great. But how to I deploy the site?

Figure out Heroku: My host, Dreamhost, does ruby hosting but it isn't that easy to setup. So I went for Heroku instead. Initially, I was following online tutorials that classmates had made for porting ITP apps to Heroku. But I couldn't get the site to run.

Hurray!

That's when I found that Rune had posted a Sinatra Heroku template. This was awesome and after a billion errors, I was able to post the site successfully. It helped that I already had an Amazon S3 account to host static files. But YAML and Heroku aren't friendly. You really have to use Heroku's Postgres database.

Heroku Postgres + Datamapper = :(

Here's where I had the most problems. Datamapper doesn't play well with postgres. I couldn't figure out why my databases weren't working. A resident helped me discover that the issue had to do with an RFID tag int that wasn't an int. In the world of postgres it was a bigint because it was too long to be just an integer.

Datamapper doesn't want to deal with bigints.

Mark helped me figure out that I could store my RFID tag id as a string. Easy enough. However, I learned that you have to reset & reinitialize the Heroku Postgres database to make it understand that you're changing the datatype.