From 0c1e4bb969a117c186e08396f9db0f747f04bdbd Mon Sep 17 00:00:00 2001 From: ysksn Date: Wed, 26 Dec 2018 14:38:42 +0900 Subject: Create DomainNormalizable#normalize_domain (#9631) --- app/models/concerns/domain_normalizable.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/models/concerns/domain_normalizable.rb (limited to 'app/models/concerns') 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 -- cgit