about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-26 14:38:42 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-26 06:38:42 +0100
commit0c1e4bb969a117c186e08396f9db0f747f04bdbd (patch)
tree0a006b6b39dcae71a50366125d4d1eb26099bbcb /app/models/concerns
parentbf70e5cfdaef9b7a3a927548a05203a864d5bea9 (diff)
Create DomainNormalizable#normalize_domain (#9631)
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