Created
January 21, 2011 16:19
-
-
Save Gregg/789910 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% current_user.who_to_follow.limit(5).each do |f| %> | |
<li><%= f.name %> - <%= link_to "Follow", follow_user_path(f) %></li> | |
<% end %> | |
# It's generally bad practice to have any code that queries your db right there in the view. You want to do the queries in your controller if at all possible. | |
<% @who_to_follow.each do |f| %> | |
<li><%= f.name %> - <%= link_to "Follow", follow_user_path(f) %></li> | |
<% end %> | |
class TweetsController < ApplicationController | |
def index | |
@who_to_follow = current_user.who_to_follow.limit(5) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment