app/models/c80_estate/property.rb in c80_estate-0.1.0.3 vs app/models/c80_estate/property.rb in c80_estate-0.1.0.4

- old
+ new

@@ -8,10 +8,16 @@ accepts_nested_attributes_for :pphotos, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true + has_many :plogos, :dependent => :destroy # одна или несколько фоток + accepts_nested_attributes_for :plogos, + :reject_if => lambda { |attributes| + !attributes.present? + }, + :allow_destroy => true has_many :areas, :dependent => :destroy has_many :comments, :dependent => :destroy has_many :sevents, :dependent => :destroy has_many :pstats, :dependent => :destroy @@ -19,9 +25,17 @@ res = "-" if assigned_person.present? res = assigned_person.email end res + end + + def logo_path + url = 'property_default_logo.png' + if plogos.count > 0 + url = plogos.first.image.thumb256 + end + url end end end \ No newline at end of file