added logic specifically for rails. this might be moved into a rails json marshal type.