about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/domain_normalizable.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/concerns/domain_normalizable.rb b/app/models/concerns/domain_normalizable.rb
new file mode 100644
index 000000000..dff3e5414
--- /dev/null
+++ b/app/models/concerns/domain_normalizable.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module DomainNormalizable
+  extend ActiveSupport::Concern
+
+  included do
+    before_validation :normalize_domain
+  end
+
+  private
+
+  def normalize_domain
+    self.domain = TagManager.instance.normalize_domain(domain)
+  end
+end