From e7d4b90cfabbecb8e9280a443764ad4e2a1fe16f Mon Sep 17 00:00:00 2001 From: Mauricio Giacomini Girardello <mgg12@inf.ufpr.br> Date: Mon, 22 Feb 2016 11:35:22 -0300 Subject: [PATCH] validate accpeted states --- app/models/concerns/stateful.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/stateful.rb b/app/models/concerns/stateful.rb index 65b899ec..389bc8ef 100644 --- a/app/models/concerns/stateful.rb +++ b/app/models/concerns/stateful.rb @@ -2,7 +2,8 @@ module Stateful extend ActiveSupport::Concern included do - validates_presence_of :state + # validates with accepted states + validates :state, inclusion: { in: %w(draft published suspended) } end def is_published? -- GitLab