Commit 6fb823a93b9dc95f54f16e7f4c094ef70a8f5537
1 parent
4fbaaa68
Exists in
master
and in
29 other branches
Plugin-PeopleBlock: load suggestions with suggested_profiles named scope
Showing
3 changed files
with
5 additions
and
5 deletions
Show diff stats
plugins/people_block/lib/friends_block.rb
@@ -17,7 +17,7 @@ class FriendsBlock < PeopleBlockBase | @@ -17,7 +17,7 @@ class FriendsBlock < PeopleBlockBase | ||
17 | end | 17 | end |
18 | 18 | ||
19 | def suggestions | 19 | def suggestions |
20 | - owner.profile_suggestions.of_person.enabled.limit(3).includes(:suggestion) | 20 | + owner.suggested_profiles.of_person.enabled.limit(3).includes(:suggestion) |
21 | end | 21 | end |
22 | 22 | ||
23 | def footer | 23 | def footer |
plugins/people_block/test/functional/profile_controller_test.rb
@@ -17,8 +17,8 @@ class ProfileControllerTest < ActionController::TestCase | @@ -17,8 +17,8 @@ class ProfileControllerTest < ActionController::TestCase | ||
17 | login_as(user.login) | 17 | login_as(user.login) |
18 | owner = user.person | 18 | owner = user.person |
19 | 19 | ||
20 | - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | ||
21 | - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | 20 | + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) |
21 | + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | ||
22 | 22 | ||
23 | FriendsBlock.delete_all | 23 | FriendsBlock.delete_all |
24 | block = FriendsBlock.new | 24 | block = FriendsBlock.new |
plugins/people_block/test/unit/friends_block_test.rb
@@ -138,8 +138,8 @@ class FriendsBlockTest < ActionView::TestCase | @@ -138,8 +138,8 @@ class FriendsBlockTest < ActionView::TestCase | ||
138 | 138 | ||
139 | should 'list owner\'s friends suggestions' do | 139 | should 'list owner\'s friends suggestions' do |
140 | owner = fast_create(Person) | 140 | owner = fast_create(Person) |
141 | - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | ||
142 | - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | 141 | + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) |
142 | + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | ||
143 | 143 | ||
144 | block = FriendsBlock.new | 144 | block = FriendsBlock.new |
145 | block.stubs(:owner).returns(owner) | 145 | block.stubs(:owner).returns(owner) |