Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. property :price, Float, :required => true, :format => /$?d{0,3}.{1}d{2}/
  2.  
  3. b.price = params[:price]
  4.  
  5. property :price, Float, :required => true
  6. validates_format_of :price, :with => /$?d{0,3}(.{1}d{2})?/
  7.  
  8. c = params[:price]
  9. c[0] == "$" ? b.price = c[1,7] : b.price = c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement