Move private method to a more reusable location
This method will be used by any translatable model that uses pg_search feature so it's better to have it within globalizable model concern so all translatable models can use it.
This commit is contained in:
committed by
voodoorai2000
parent
036a3d7636
commit
ed750f6cce
@@ -20,6 +20,18 @@ module Globalizable
|
|||||||
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||||
translation_class.send :acts_as_paranoid, column: :hidden_at
|
translation_class.send :acts_as_paranoid, column: :hidden_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def searchable_globalized_values
|
||||||
|
values = {}
|
||||||
|
translations.each do |translation|
|
||||||
|
Globalize.with_locale(translation.locale) do
|
||||||
|
values.merge! searchable_translations_definitions
|
||||||
|
end
|
||||||
|
end
|
||||||
|
values
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|||||||
@@ -165,16 +165,4 @@ class Debate < ApplicationRecord
|
|||||||
orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates
|
orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates
|
||||||
return orders
|
return orders
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def searchable_globalized_values
|
|
||||||
values = {}
|
|
||||||
translations.each do |translation|
|
|
||||||
Globalize.with_locale(translation.locale) do
|
|
||||||
values.merge! searchable_translations_definitions
|
|
||||||
end
|
|
||||||
end
|
|
||||||
values
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user