Correctly set constant in including modules (#11331)

This commit is contained in:
Michael Kohl 2020-11-10 08:47:30 +07:00 committed by GitHub
parent dfc3d96286
commit 5664cd3ca8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,12 @@
# Used for sharing behavior between ProfileField and CustomProfileField
concern :ActsAsProfileField do
module ActsAsProfileField
extend ActiveSupport::Concern
WORD_REGEX = /\w+/.freeze
included do
before_create :generate_attribute_name
WORD_REGEX = /\w+/.freeze # rubocop:disable Lint/ConstantDefinitionInBlock
validates :label, presence: true, uniqueness: { case_sensitive: false }
validates :attribute_name, presence: true, on: :update
end