Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding in validation on Enquires

  • Loading branch information...
commit 68382b0d6549ba3562ff463db5eb20a42cb19428 1 parent 8cd4068
@chrisfleming authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 app/models/enquiry.rb
View
10 app/models/enquiry.rb
@@ -1,4 +1,14 @@
class Enquiry < ActiveRecord::Base
+ validates :firstname, :surname, presence: true
+ validate :some_contact_details
+
+ def some_contact_details
+ if self.phone == "" && self.email == ""
+ errors.add(:phone, "Please Supply a Phone Number or E-mail address")
+ end
+ end
+
+
def IsCommentSpam()
# Original PHP code
Please sign in to comment.
Something went wrong with that request. Please try again.