Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed pagination on association.

Signed-off-by: Francesc Esplugas <francesc.esplugas@gmail.com>
  • Loading branch information...
commit d52962a42c57eb631c11d577d3f1b1f31ff5c3bd 1 parent be32619
@fesplugas fesplugas authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/helpers/admin/resources/relationships_helper.rb
View
9 app/helpers/admin/resources/relationships_helper.rb
@@ -12,7 +12,14 @@ def build_pagination
items_per_page = @model_to_relate.typus_options_for(:per_page)
data = @item.send(@field).order(@model_to_relate.typus_order_by).where(set_conditions)
page = params["#{@association_name}_page"]
- @items = data.page(page).per(items_per_page)
+
+ @items = if defined?(Kaminari)
+ data.page(page).per(items_per_page)
+ elsif defined?(WillPaginate)
+ data.paginate(:page => params[:page], :per_page => items_per_page)
+ else
+ data.limit(items_per_page)
+ end
end
def build_relationship_table
Please sign in to comment.
Something went wrong with that request. Please try again.