diff --git a/core/lib/refinery/crud.rb b/core/lib/refinery/crud.rb index 80a5004518..2fb102fecb 100644 --- a/core/lib/refinery/crud.rb +++ b/core/lib/refinery/crud.rb @@ -161,11 +161,14 @@ def paginate_all_#{plural_name} paging_options = {:page => params[:page]} + # Use per_page from crudify options. + if #{options[:per_page]} + paging_options.update({:per_page => #{options[:per_page].inspect}}) # Seems will_paginate doesn't always use the implicit method. - if #{class_name}.methods.map(&:to_sym).include?(:per_page) + elsif #{class_name}.methods.map(&:to_sym).include?(:per_page) paging_options.update({:per_page => #{class_name}.per_page}) end - + @#{plural_name} = @#{plural_name}.paginate(paging_options) end