From 39c5f8febec705d0b162f9f02c0ac45498e6c147 Mon Sep 17 00:00:00 2001 From: Lynne Davis Date: Mon, 2 Mar 2015 12:32:28 +1100 Subject: [PATCH] Updating Customer model with validations --- app/models/customer.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/customer.rb b/app/models/customer.rb index 047dcb0c04..3dbdd59a67 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -1,2 +1,8 @@ class Customer < ActiveRecord::Base + + belongs_to :enterprise + + validates :code, presence: true, uniqueness: {scope: :enterprise_id} + validates :email, presence: true + validates :enterprise_id, presence: true end