summaryrefslogtreecommitdiff
path: root/app/models/concerns/valid_attribute.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-07-21 11:40:49 +0200
committerJames Lopez <james@jameslopez.es>2017-01-11 15:07:09 +0100
commitd3cfa39e3cb7a4a04f3f42d00c4740d317690bbc (patch)
treeb7553bcc4875f95d1dddaf3a7d41e932a0afeb53 /app/models/concerns/valid_attribute.rb
parent4404ea8662508c60f96e6730d9a45feb68498c28 (diff)
downloadgitlab-ce-d3cfa39e3cb7a4a04f3f42d00c4740d317690bbc.tar.gz
New error message recreating projects on pending deletefix/project-delete-tooltip
Diffstat (limited to 'app/models/concerns/valid_attribute.rb')
-rw-r--r--app/models/concerns/valid_attribute.rb10
1 files changed, 10 insertions, 0 deletions
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