app/models/c80_estate/property.rb in c80_estate-0.1.0.19 vs app/models/c80_estate/property.rb in c80_estate-0.1.0.20

- old
+ new

@@ -19,9 +19,18 @@ has_many :areas, :dependent => :destroy has_many :comments, :dependent => :destroy has_many :sevents, :dependent => :destroy has_many :pstats, :dependent => :destroy + # этот метод для ActiveRecordCollection of Properties + def self.areas_count + ac = 0 + self.all.each do |prop| + ac += prop.areas.count + end + ac + end + def assigned_person_title res = "-" if assigned_person.present? res = assigned_person.email end \ No newline at end of file