12.2 a web interface for following and followers.
1.before we do the UI, we need to populate database.
we will write a rake task to do this:
?
?
?4. next we will do the stats partial:
?
?note, we don't need to hidden field here, since we only need the id to delete a object.
?
next we can put the stats partial and follow/unfollow partials into profile pages.
?
9. next, we will make following page and followers page.
first, we will make the link to following and followers page work, so first write test:
?next, we will write code to make the test pass.
we need to add two new actions to users controller.
?now we can write create and destroy method to make this test pass:
class RelationshipsController < ApplicationController before_filter :authenticate def create @user = User.find(params[:relationship][:followed_id]) current_user.follow!(@user) redirect_to @user end def destroy @user = Relationship.find(params[:id]).followed current_user.unfollow!(@user) redirect_to @user endend?