From 50c8bf79b9c563a65e36fffdc18ed461a41610a0 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sun, 26 Oct 2014 12:30:22 +1100 Subject: [PATCH] Section 1.2.7: Validations --- things_i_bought/app/models/purchase.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/things_i_bought/app/models/purchase.rb b/things_i_bought/app/models/purchase.rb index e688f99..2128ffa 100644 --- a/things_i_bought/app/models/purchase.rb +++ b/things_i_bought/app/models/purchase.rb @@ -1,2 +1,4 @@ class Purchase < ActiveRecord::Base + validates :name, presence: true + validates :cost, numericality: { greater_than: 0 } end