Method: Propertyware::SaveBuilding#valid?

Defined in:
lib/propertyware/models/save_building.rb

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/propertyware/models/save_building.rb', line 422

def valid?
  return false if @abbreviation.nil?
  allocation_method_validator = EnumAttributeValidator.new('String', ["By Square Foot", "By Percent"])
  return false unless allocation_method_validator.valid?(@allocation_method)
  return false if @category.nil?
  category_validator = EnumAttributeValidator.new('String', ["RESIDENTIAL", "COMMERCIAL"])
  return false unless category_validator.valid?(@category)
  return false if @count_unit.nil?
  return false if @name.nil?
  return false if @portfolio_id.nil?
  return false if @property_type.nil?
  property_type_validator = EnumAttributeValidator.new('String', ["NONE", "APARTMENT", "CONDO", "COMMERCIAL", "DU_FOUR_PLEX", "HOUSE", "SECTION_8_AFFORDABLE", "SENIOR", "SHORT_TERM_VACATION", "STUDENT", "TOWNHOUSE", "OTHER"])
  return false unless property_type_validator.valid?(@property_type)
  published_for_rent_validator = EnumAttributeValidator.new('String', ["Yes", "No"])
  return false unless published_for_rent_validator.valid?(@published_for_rent)
  return false if @type.nil?
  true
end