module Nizza
  class Property < ActiveRecord::Base

    scope :hotel_properties,  -> { where(properable_type: Property::HOTEL_PROPERTY) }

    def hotel_property?
      if properable_type == Property::HOTEL_PROPERTY
        true
      else
        false
      end
    end

    def hotel_belongs!
      self.properable_type = Property::HOTEL_PROPERTY
      save
    end

    def self.hotel_property_codes
      Nizza::Property.hotel_properties.map(&:code).uniq.sort
    end

  end
end
