Skip to content

Commit

Permalink
Force notes list to be realised in notes#mine
Browse files Browse the repository at this point in the history
There is a rails bug which means that using count on a relation
that uses uniq and offset/limit and which hasn't been realised
yet will always return one, so force it to be realised.
  • Loading branch information
tomhughes committed Jun 10, 2013
1 parent 82f8968 commit cc8bfc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def mine
@description = t 'note.mine.subheading', :user => render_to_string(:partial => "user", :object => @this_user)
@page = (params[:page] || 1).to_i
@page_size = 10
@notes = @this_user.notes.order("updated_at DESC, id").uniq.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author)
@notes = @this_user.notes.order("updated_at DESC, id").uniq.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author).all
else
@title = t 'user.no_such_user.title'
@not_found_user = params[:display_name]
Expand Down

0 comments on commit cc8bfc0

Please sign in to comment.