lib/patch_ruby/models/allocation.rb in patch_ruby-1.0.0 vs lib/patch_ruby/models/allocation.rb in patch_ruby-1.1.0

- old
+ new

@@ -79,15 +79,30 @@ # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @production.nil? + invalid_properties.push('invalid value for "production", production cannot be nil.') + end + + if @mass_g.nil? + invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.') + end + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return false if @id.nil? + return false if @production.nil? + return false if @mass_g.nil? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared