Skip to content

Commit

Permalink
Fix for ordering with a default_scope order in place.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joost Hietbrink committed Aug 22, 2012
1 parent dcf4d82 commit 85e931c
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -18,7 +18,9 @@ def destroy_all
# Use meta_search and kaminari gem to load collection.
# Saves the per parameter to the user's session[:admin_per].
def collection
@search ||= end_of_association_chain.ransack(params[:q])
@search ||= end_of_association_chain
@search = @search.reorder('') if params[:q].present? && params[:q][:s].present? # We reorder to nothing if we have Ransack sort parameters.
@search = @search.ransack(params[:q])
get_collection_ivar || begin
session[:admin_per] = params[:per] || session[:admin_per] # Save the per_page to the user's session
c = @search.result.page(params[:page]).per(session[:admin_per])
Expand Down

0 comments on commit 85e931c

Please sign in to comment.