Followers and Following
Listen now
Description
In order to get someone a timeline in JotRod, we need followers and following lists to compile the Jots from. This means that we need to add a new ColumnFamily called Followers and another one called Following. We don't have the joins capability from relational databases to do this for us. I'm going to hijack the User model's database connection to create the ColumnFamilies. (We don't have migrations, yet.) Here's what I ran in the rails console: cf_def = CassandraThrift::CfDef.new(:keyspace => "JotRod", :name => "Followers") User.connection.add_column_family(cf_def) cf_def = CassandraThrift::CfDef.new(:keyspace => "JotRod", :name => "Following") User.connection.add_column_family(cf_def) Now that we have the ColumnFamilies, I want to have syntax like this to define the relationships on the User model: list :followers, :User list :following, :User This should provide the following API: #followers - returns an array of users as specified from the Followers ColumnFamily #followers(user)  - adds the user to the User object's followers list if it's not already there and a similar API for following. Sandra's repository JotRod's repository Download 680 MB Download (iPod & iPhone) 165 MB Take the 2011 Readers Survey
More Episodes
My Equipment: Mackie PROFX12 12-Channel Compact Effects Mixer with USB Sony MDR7506 Professional Large Diaphragm Headphone Roland R-05 Studio WAVE/MP3 Recorder Transcend 32 GB Class 10 SDHC Flash Memory Card (TS32GSDHC10E) (for the Roland R-05) Griffin Technology iMic USB Audio...
Published 12/20/12
Published 12/20/12
When preparing to add some layout features to JotRod, I realized it was a Rails 3.0.9 application. Here's a quick rundown on upgrading to Rails 3.1.3. Download 164.7 MB Download (iPod & iPhone) 37.9 MB Take the 2011 Readers Survey
Published 12/09/11