Sha256: b999f6863fcd6dce582383b22b060441f8ec01b3c234fe8d0c8a3fe5f3c2afc0
Contents?: true
Size: 766 Bytes
Versions: 1
Compression:
Stored size: 766 Bytes
Contents
class Property < MLS::Model include MLS::Slugger include MLS::Avatar belongs_to :contact, :class_name => 'Account' has_many :listings has_many :localities has_many :regions, :through => :localities has_many :photos, -> { where(:type => "Photo").order(:order => :asc) }, :as => :subject, :inverse_of => :subject has_many :internal_photos, -> { order(:order => :asc) }, :as => :subject, :inverse_of => :subject has_many :addresses do def primary where(:primary => true).first end end def default_contact @default_contact ||= listings.where(lease_state: :listed, ghost: false, authorized: true) .where({ type: ['Lease', 'Sublease']}) .order(size: :desc) .first.try(:contact) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mls-1.4.0 | lib/mls/property.rb |