no more n-query in the view problem
This commit is contained in:
parent
402e84708b
commit
ee49fb3547
3 changed files with 6 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ class ContactsController < ApplicationController
|
|||
end
|
||||
|
||||
def sharing
|
||||
@contacts = current_user.contacts.sharing
|
||||
@contacts = current_user.contacts.sharing.includes(:aspects)
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ Feature: sending and receiving requests
|
|||
|
||||
And I am on "bob@bob.bob"'s page
|
||||
|
||||
Then I should not see "Add to aspect"
|
||||
Then I should see "In 2 aspects"
|
||||
Then I should see "Mention"
|
||||
Then I should see "Message"
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ describe ContactsController do
|
|||
response.should be_success
|
||||
end
|
||||
|
||||
it 'eager loads the aspects' do
|
||||
get :sharing
|
||||
assigns[:contacts].first.aspects.loaded?.should be_true
|
||||
end
|
||||
|
||||
it "assigns only the people sharing with you with 'share_with' flag" do
|
||||
get :sharing, :id => 'share_with'
|
||||
assigns[:contacts].to_set.should == alice.contacts.sharing.to_set
|
||||
|
|
|
|||
Loading…
Reference in a new issue