0

Im using DataMapper in my Sinatra application.I defined a property called 'to' whose minimum length i want to be 10

property :to,String,:required => true,:min => 10  

This causes my application to crash with the error

assert_valid_options': options :min are unknown (ArgumentError)

Am i specifying the min length in the right way ?

Thank You

Kris
  • 1,313
  • 3
  • 16
  • 26

1 Answers1

0

Try

validates_length_of :to, :min => 10

If you know the maximum length of your string, you can do

property :to,String,:required => true,:min => 10 ,:length => 10..20  #length must be between 10 to 20 char
revolver
  • 2,243
  • 5
  • 21
  • 40