0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-05 17:25:34 +08:00
discourse/app/models/concerns/has_search_data.rb
Jarek Radosz 8baf4d5d4c
DEV: Enable Style/RedundantSelf rubocop rule (#40098)
(to be enabled in the shared config)
2026-05-19 19:27:45 +02:00

12 lines
321 B
Ruby
Vendored

# frozen_string_literal: true
module HasSearchData
extend ActiveSupport::Concern
included do
_associated_record_name = name.sub("SearchData", "").underscore
self.primary_key = "#{_associated_record_name}_id"
belongs_to _associated_record_name.to_sym
validates :search_data, presence: true
end
end