Sha256: 52d871d1b187ff277d40f448b8a25bc620067f20d334bb2458ff820fb806a159

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

module C80Estate
  class Property < ActiveRecord::Base
    belongs_to :atype
    belongs_to :owner, :polymorphic => true
    belongs_to :assigned_person, :polymorphic => true
    has_many :item_props, :dependent => :destroy
    has_many :pphotos, :dependent => :destroy   # одна или несколько фоток
    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

    def assigned_person_title
      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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
c80_estate-0.1.0.14 app/models/c80_estate/property.rb
c80_estate-0.1.0.13 app/models/c80_estate/property.rb
c80_estate-0.1.0.12 app/models/c80_estate/property.rb
c80_estate-0.1.0.11 app/models/c80_estate/property.rb
c80_estate-0.1.0.10 app/models/c80_estate/property.rb
c80_estate-0.1.0.9 app/models/c80_estate/property.rb
c80_estate-0.1.0.8 app/models/c80_estate/property.rb
c80_estate-0.1.0.7 app/models/c80_estate/property.rb
c80_estate-0.1.0.6 app/models/c80_estate/property.rb
c80_estate-0.1.0.5 app/models/c80_estate/property.rb
c80_estate-0.1.0.4 app/models/c80_estate/property.rb