Skip to content

Commit

Permalink
Merge pull request #31 from flyerhzm/rails-4
Browse files Browse the repository at this point in the history
use \A \z instead of ^ $ for validation
  • Loading branch information
JDutil committed Jul 6, 2013
2 parents 8101434 + 778ef46 commit 6e867c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/contact_us/contact.rb
Expand Up @@ -4,7 +4,7 @@ class ContactUs::Contact

attr_accessor :email, :message, :name, :subject

validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i },
validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i },
:presence => true
validates :message, :presence => true
validates :name, :presence => {:if => Proc.new{ContactUs.require_name}}
Expand All @@ -23,7 +23,7 @@ def save
end
return false
end

def persisted?
false
end
Expand Down

0 comments on commit 6e867c9

Please sign in to comment.