Permalink
Browse files

Fix regular expression in order validation

  • Loading branch information...
1 parent a3bfd49 commit bea89bbdb5480aa5c72aa848c38b587d0db68557 @ancorgs ancorgs committed Mar 11, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/order.rb
View
@@ -28,6 +28,6 @@ class Order < ActiveRecord::Base
:phone, :email, :amount, :reason, :deadline
validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create }
- validates :deadline, format: { with: %r{^2[0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]}, on: :create }, unless: "deadline == 'NONE'"
+ validates :deadline, format: { with: %r{\A2[0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]}, on: :create }, unless: "deadline == 'NONE'"
validates_numericality_of :amount
end

0 comments on commit bea89bb

Please sign in to comment.