<div id="repos">
	<div class="rhead">All Public Repositories <%= if logged_in? then link_to_unless_current '[Add]', { :action => 'new', :controller => 'repo' }, :rel => 'facebox' else link_to_unless_current '[Add]', { :action => 'new', :controller => 'repo' } end %> </div>
	<div id="repolist">
	
	<% for repo in @repos%>
	
		<div class="reponame"><%= link_to(repo.name, :controller=>'repo', :action => 'show', :id => repo.id)%></div>
		<div class="repodesc">Description: <%= repo.desc%></div>
		<div class="repoowner">Owner: <%=link_to user_lookup(repo.user_id).username, :controller => 'user', :action => 'profile', :username => repo.user.username%></div>
		<div class="rnav">
		<% if logged_in?%>
			<% if watching_repo?(repo.id) != 0 %>
				<%=link_to 'Un-Watch', {:action => "unwatch", :repo_id => repo.id}, :method => :post %>
			<%else%>
				<%=link_to 'Watch', {:action => "watch", :repo_id => repo.id}, :method => :post %>
			<%end%>
		<%end%>
		</div>
		<div class="rdiv"><img src="/images/div.jpg" alt="---"/></div>
		
	
	<%end%>
	
	</div>
	
</div>
<div id="repos">
	<div class="rhead">All Public Repositories <%= if logged_in? then link_to_unless_current '[Add]', { :action => 'new', :controller => 'repo' }, :rel => 'facebox' else link_to_unless_current '[Add]', { :action => 'new', :controller => 'repo' } end %> </div>
	<div id="repolist">
	
	<% for repo in @repos%>
	
		<div class="reponame"><%= link_to(repo.name, :controller=>'repo', :action => 'show', :id => repo.id)%></div>
		<div class="repodesc">Description: <%= repo.desc%></div>
		<div class="repoowner">Owner: <%=link_to repo.user.username, :controller => 'user', :action => 'profile', :username => repo.user.username%></div>
		<div class="rnav">
		<% if logged_in?%>
			<% if watching_repo?(repo.id) != 0 %>
				<%=link_to 'Un-Watch', {:action => "unwatch", :repo_id => repo.id}, :method => :post %>
			<%else%>
				<%=link_to 'Watch', {:action => "watch", :repo_id => repo.id}, :method => :post %>
			<%end%>
		<%end%>
		</div>
		<div class="rdiv"><img src="/images/div.jpg" alt="---"/></div>
		
	
	<%end%>
	
	</div>
	
</div>
Reduce lookups on the public repos page by using joins in the model
Reduce lookups on the public repos page by using joins in the model
