Fix detect_remote_translations for Legislation::Proposal
Legislation::Proposal is not Globalize model but use CommentableActions and try
detect remote translations. Add new condition to discard Non Globalize models.
This fix is necessary since the following commit was included: c1f3a4ad.
This commit is contained in:
@@ -16,7 +16,7 @@ module RemotelyTranslatable
|
||||
end
|
||||
|
||||
def translation_empty?(resource)
|
||||
resource.translations.where(locale: I18n.locale).empty?
|
||||
resource.class.translates? && resource.translations.where(locale: I18n.locale).empty?
|
||||
end
|
||||
|
||||
def resources_groups(*args)
|
||||
|
||||
@@ -65,5 +65,13 @@ describe RemotelyTranslatable do
|
||||
|
||||
expect(detect_remote_translations([proposal, comment])).to eq []
|
||||
end
|
||||
|
||||
it "When resource class is not translatable should not detect remote_translations" do
|
||||
legislation_proposal = create(:legislation_proposal)
|
||||
|
||||
I18n.with_locale(:es) do
|
||||
expect(detect_remote_translations([legislation_proposal])).to eq []
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user