2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-15 11:46:57 -04:00
|
|
|
module HasSearchData
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2018-06-26 12:32:13 -04:00
|
|
|
_associated_record_name = self.name.sub('SearchData', '').underscore
|
|
|
|
self.primary_key = "#{_associated_record_name}_id"
|
|
|
|
belongs_to _associated_record_name.to_sym
|
2017-08-15 11:46:57 -04:00
|
|
|
validates_presence_of :search_data
|
|
|
|
end
|
|
|
|
end
|