lib/active_admin/views/components/paginated_collection.rb in activeadmin-1.0.0.pre2 vs lib/active_admin/views/components/paginated_collection.rb in activeadmin-1.0.0.pre3
- old
+ new
@@ -42,11 +42,11 @@
@param_name = options.delete(:param_name)
@download_links = options.delete(:download_links)
@display_total = options.delete(:pagination_total) { true }
@per_page = options.delete(:per_page)
- unless collection.respond_to?(:num_pages)
+ unless collection.respond_to?(:total_pages)
raise(StandardError, "Collection is not a paginated scope. Set collection.page(params[:page]).per(10) before calling :paginated_collection.")
end
@contents = div(class: "paginated_collection_contents")
build_pagination_with_formats(options)
@@ -130,11 +130,11 @@
entry_name = I18n.translate key, count: 1, default: collection.first.class.name.underscore.sub('_', ' ')
entries_name = I18n.translate key, count: collection.size, default: entry_name.pluralize
end
if @display_total
- if collection.num_pages < 2
+ if collection.total_pages < 2
case collection_size
when 0; I18n.t("active_admin.pagination.empty", model: entries_name)
when 1; I18n.t("active_admin.pagination.one", model: entry_name)
else; I18n.t("active_admin.pagination.one_page", model: entries_name, n: collection.total_count)
end
@@ -147,10 +147,10 @@
from: offset + 1,
to: offset + collection_size
end
else
# Do not display total count, in order to prevent a `SELECT count(*)`.
- # To do so we must not call `collection.num_pages`
+ # To do so we must not call `collection.total_pages`
offset = (collection.current_page - 1) * collection.limit_value
I18n.t "active_admin.pagination.multiple_without_total",
model: entries_name,
from: offset + 1,
to: offset + collection_size