lib/active_collection/pagination.rb in active_collection-0.2.3 vs lib/active_collection/pagination.rb in active_collection-0.2.4

- old
+ new

@@ -129,11 +129,11 @@ end end # Total number of pages. def total_pages - @total_pages ||= (total_entries / per_page.to_f).ceil + (total_entries / per_page.to_f).ceil end # return a paginated collection if it isn't already paginated. # returns self if already paginated. def paginate @@ -151,10 +151,11 @@ # if the collection has a page parameter def paginated? current_page && current_page > 0 end + # TODO clean this up def as_data_hash data_hash = { "collection" => collection.as_json } if paginated? data_hash["total_entries"] = total_entries data_hash["page"] = current_page @@ -162,9 +163,10 @@ data_hash["total_pages"] = total_pages end data_hash end + # TODO clean this up def to_xml(options = {}) collect options[:indent] ||= 2 xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent]) xml.instruct! unless options[:skip_instruct]