From d3cfa39e3cb7a4a04f3f42d00c4740d317690bbc Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 21 Jul 2016 11:40:49 +0200 Subject: New error message recreating projects on pending delete --- app/models/concerns/valid_attribute.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/models/concerns/valid_attribute.rb (limited to 'app/models/concerns/valid_attribute.rb') diff --git a/app/models/concerns/valid_attribute.rb b/app/models/concerns/valid_attribute.rb new file mode 100644 index 00000000000..8c35cea8d58 --- /dev/null +++ b/app/models/concerns/valid_attribute.rb @@ -0,0 +1,10 @@ +module ValidAttribute + extend ActiveSupport::Concern + + # Checks whether an attribute has failed validation or not + # + # +attribute+ The symbolised name of the attribute i.e :name + def valid_attribute?(attribute) + self.errors.empty? || self.errors.messages[attribute].nil? + end +end -- cgit v1.2.1