Don't query current_user.contacts on every action

This commit is contained in:
Raphael 2010-12-14 12:38:48 -08:00
parent e63a8a4bfa
commit d3850292d5
2 changed files with 3 additions and 1 deletions

View file

@ -17,7 +17,6 @@ class ApplicationController < ActionController::Base
@aspect = nil
@aspects = current_user.aspects.fields(:name)
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
@contacts = current_user.contacts
end
end

View file

@ -11,6 +11,7 @@ class AspectsController < ApplicationController
def index
@posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
@post_hashes = hashes_for_posts @posts
@contacts = current_user.contacts
@aspect_hashes = hashes_for_aspects @aspects.all, @contacts, :limit => 8
@aspect = :all
@ -61,6 +62,7 @@ class AspectsController < ApplicationController
def show
@aspect = current_user.aspect_by_id params[:id]
@contacts = current_user.contacts
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
@ -77,6 +79,7 @@ class AspectsController < ApplicationController
def manage
@aspect = :manage
@contacts = current_user.contacts
@remote_requests = Request.hashes_for_person(current_user.person)
@aspect_hashes = hashes_for_aspects @aspects, @contacts
end