ruby on rails 3 - How to display a list of following users/followers? -


i'm trying display user's following , followers, not work reason , not throw error messages. here's code:

following , followers action in users_controller.rb:

def following

@title = "following" @user = user.find(params[:id]) @users = @user.following(user) render 'following' 

end

def followers

@title = "followers" @user = user.find(params[:id]) @users = @user.followers(user) render 'followers' 

end

following.html.haml

  • provide(:title, @title)

  • content_for(:side_bar) do

%section

%span= link_to "view profile", @user

%section

= render 'users/stats' 
  • if @users.any?

    %ul.users

    = render @users

  • else

    %p

    you aren't following yet.

_stats.html.haml

  • @user ||= current_user
  • provide(:title, @title)
  • content_for(:side_bar) do

    %section

    = gravatar_for @user

    %h1= @user.name

.stats

%table.info

%tr   %td     %a{:href => tweets_path(@tweet)}       %strong#tweet.stat         = @user.tweets.count       tweets   %td     %a{:href => following_user_path(@user)}       %strong#following.stat         = @user.following.count       following   %td     %a{:href => followers_user_path(@user)}       %strong#followers.stat         = @user.followers.count       followers 

i'm new rails, if can explain i'm missing, i'll glad. thank you!


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -