lib/rentjuicer/listings.rb in rentjuicer-0.4.4 vs lib/rentjuicer/listings.rb in rentjuicer-0.5.0
- old
+ new
@@ -64,22 +64,24 @@
@limit = limit
end
def properties
return [] if self.body.listings.blank?
- props = []
- self.body.listings.each do |listing|
- props << Rentjuicer::Listing.new(listing)
+ @cached_properties ||= begin
+ props = []
+ self.body.listings.each do |listing|
+ props << Rentjuicer::Listing.new(listing)
+ end
+ props
end
- props
end
def mls_results?
- properties.any?{|property| property.mls_listing?}
+ @has_mls_properties ||= properties.any?{|property| property.mls_listing?}
end
def mls_disclaimers
- properties.collect{|property| property.mls_disclaimer}.compact.uniq
+ @disclaimers ||= properties.collect{|property| property.mls_disclaimer}.compact.uniq
end
def paginator
paginator_cache if paginator_cache
self.paginator_cache = WillPaginate::Collection.create(