Don't query current_user.contacts on every action
This commit is contained in:
parent
e63a8a4bfa
commit
d3850292d5
2 changed files with 3 additions and 1 deletions
|
|
@ -17,7 +17,6 @@ class ApplicationController < ActionController::Base
|
||||||
@aspect = nil
|
@aspect = nil
|
||||||
@aspects = current_user.aspects.fields(:name)
|
@aspects = current_user.aspects.fields(:name)
|
||||||
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
||||||
@contacts = current_user.contacts
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class AspectsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
@posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
||||||
@post_hashes = hashes_for_posts @posts
|
@post_hashes = hashes_for_posts @posts
|
||||||
|
@contacts = current_user.contacts
|
||||||
@aspect_hashes = hashes_for_aspects @aspects.all, @contacts, :limit => 8
|
@aspect_hashes = hashes_for_aspects @aspects.all, @contacts, :limit => 8
|
||||||
@aspect = :all
|
@aspect = :all
|
||||||
|
|
||||||
|
|
@ -61,6 +62,7 @@ class AspectsController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@aspect = current_user.aspect_by_id params[:id]
|
@aspect = current_user.aspect_by_id params[:id]
|
||||||
|
@contacts = current_user.contacts
|
||||||
unless @aspect
|
unless @aspect
|
||||||
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
||||||
else
|
else
|
||||||
|
|
@ -77,6 +79,7 @@ class AspectsController < ApplicationController
|
||||||
|
|
||||||
def manage
|
def manage
|
||||||
@aspect = :manage
|
@aspect = :manage
|
||||||
|
@contacts = current_user.contacts
|
||||||
@remote_requests = Request.hashes_for_person(current_user.person)
|
@remote_requests = Request.hashes_for_person(current_user.person)
|
||||||
@aspect_hashes = hashes_for_aspects @aspects, @contacts
|
@aspect_hashes = hashes_for_aspects @aspects, @contacts
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue