lib/rentjuicer/listings.rb in rentjuicer-0.6.1 vs lib/rentjuicer/listings.rb in rentjuicer-0.6.2

- old
+ new

@@ -30,11 +30,11 @@ all_listings = [] response = search(params) if response.success? all_listings << response.properties - total_pages = (response.body.total_count/per_page.to_f).ceil + total_pages = (response.total_results/per_page.to_f).ceil if total_pages > 1 (2..total_pages).each do |page_num| resp = search(params.merge(:page => page_num)) if resp.success? all_listings << resp.properties @@ -73,10 +73,14 @@ end props end end + def total_results + self.body.total_count ? self.body.total_count : properties.size + end + def mls_results? @has_mls_properties ||= properties.any?{|property| property.mls_listing?} end def mls_disclaimers @@ -86,10 +90,10 @@ def paginator paginator_cache if paginator_cache self.paginator_cache = WillPaginate::Collection.create( self.body.page ||= 1, @limit, - (self.body.total_count ? self.body.total_count : properties.size)) do |pager| + self.total_results) do |pager| pager.replace properties end end end