Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.46 KB | None | 0 0
  1. validation1 = lambda {|value|
  2.             weight = value.gsub(',', '.').to_f
  3.             if weight < 30 || weight > 200
  4.               true
  5.             end
  6.             }
  7.  
  8. @form_model.text :weight, :label => 'Weight', :class => ['input-small', 'float-left'], :label_class => ['label-block-right'], :initial => user["model"]["weight"], :validation => [[/^[0-9\.\,]+$/, "Only numbers allowed"], [validation1, "The weight has to be 30kg or more, but less than 200kg"]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement