Rails counter cache not updating

They sent it out to friends and family, and hoped for the best. There had just been another Facebook privacy scandal, and when the dust settled on their Kickstarter, they had raised over 0,000 from 6400 different people for a software project that didn’t yet have a single line of code written.

By the end of that first summer, though, they already had a minimal but working (for some definition) implementation of a distributed social network built in Ruby on Rails and backed by Mongo DB. It’s a web app, it runs on a single logical server, and it lets you stay in touch with people.

Once you log in, Diaspora’s interface looks structurally similar to Facebook’s: There’s a feed in the middle showing all your friends’ posts, and some other random stuff along the sides that no one has ever looked at.

Once you set up an account on a pod, it’ll be pretty boring until you follow some other people. The system survives, and even expects, network partitioning.

You can follow other users on your pod, and you can also follow people who are users on other pods. There are some interesting political implications to that — for example, if you’re in a country that shuts down outgoing internet to prevent access to Facebook and Twitter, your pod running locally still connects you to other people within your country, even though nothing outside is accessible. Each pod is a legally separate entity, governed by the laws of wherever it’s set up. On most of them, you can post content without giving up your rights to it, unlike on Facebook.

I see apps with different requirements and different data storage needs.

I run 4-6 different projects every year, so I build a lot of web applications.

And of course, Mongo DB is an atypical choice for data storage. “Social data” is information about our network of friends, their friends, and their activity.

The vast majority of Rails applications are backed by Postgre SQL or (less often these days) My SQL. Conceptually, we do think about it as a network — an undirected graph in which we are in the center, and our friends radiate out around us. Thanks Matt Rogers, Steve Klabnik, Nell Shamrell, Katrina Owen, Sam Livingston-Grey, Josh Susser, Akshay Khole, Pradyumna Dandwate, and Hephzibah Watharkar for contributing to #rubyfriends!

When we store social data, we’re storing that graph topology, as well as the activity that moves along those edges.

For quite a few years now, the received wisdom has been that social data is not relational, and that if you store it in a relational database, you’re doing it wrong. Some folks say graph databases are more natural, but I’m not going to cover those here, since graph databases are too niche to be put into production.

(I asked where the Romulans’ access point was once, and got a bunch of blank looks.