# File lib/dm-validations/auto_validate.rb, line 133 def infer_length_validation_for(property, options) return unless [ String, DataMapper::Types::Text ].include?(property.type) case length = property.options.fetch(:length, DataMapper::Property::DEFAULT_LENGTH) when Range then options[:within] = length else options[:maximum] = length end validates_length property.name, options_with_message(options, property, :length) end