Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for ordering with a default_scope order in place.

  • Loading branch information...
commit 85e931c984b345805122516f3fb367e337f1bd7b 1 parent dcf4d82
@joost authored
View
4 lib/generators/admin_interface/templates/setup/controllers/resource_controller.rb
@@ -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])
Please sign in to comment.
Something went wrong with that request. Please try again.