Commit 64cf718401e6fcab9572e72d7534fb0b2b224006
1 parent
24c27953
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Fix problem when listing profiles with included relations
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
app/controllers/public/profile_controller.rb
| ... | ... | @@ -55,7 +55,7 @@ class ProfileController < PublicController |
| 55 | 55 | |
| 56 | 56 | def communities |
| 57 | 57 | if is_cache_expired?(profile.communities_cache_key(params)) |
| 58 | - @communities = profile.communities.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage], :total_entries => profile.communities.count) | |
| 58 | + @communities = profile.communities.paginate(:per_page => per_page, :page => params[:npage], :total_entries => profile.communities.count).includes(relations_to_include) | |
| 59 | 59 | end |
| 60 | 60 | end |
| 61 | 61 | |
| ... | ... | @@ -65,13 +65,13 @@ class ProfileController < PublicController |
| 65 | 65 | |
| 66 | 66 | def friends |
| 67 | 67 | if is_cache_expired?(profile.friends_cache_key(params)) |
| 68 | - @friends = profile.friends.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage]) | |
| 68 | + @friends = profile.friends.paginate(:per_page => per_page, :page => params[:npage]).includes(relations_to_include) | |
| 69 | 69 | end |
| 70 | 70 | end |
| 71 | 71 | |
| 72 | 72 | def members |
| 73 | 73 | if is_cache_expired?(profile.members_cache_key(params)) |
| 74 | - @members = profile.members_by_name.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
| 74 | + @members = profile.members_by_name.paginate(:per_page => members_per_page, :page => params[:npage]).includes(relations_to_include) | |
| 75 | 75 | end |
| 76 | 76 | end |
| 77 | 77 | ... | ... |