Speaking of refactoring this view code, I would take most of the last if statement into a helper method, something like = follow_or_unfollow_button which would result in much succinct view code