diff --git a/app/controllers/concerns/remotely_translatable.rb b/app/controllers/concerns/remotely_translatable.rb index 7f47f0c8f..6bbf791d1 100644 --- a/app/controllers/concerns/remotely_translatable.rb +++ b/app/controllers/concerns/remotely_translatable.rb @@ -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) diff --git a/spec/controllers/concerns/remotely_translatable_spec.rb b/spec/controllers/concerns/remotely_translatable_spec.rb index 8320e778c..d9cd7e73e 100644 --- a/spec/controllers/concerns/remotely_translatable_spec.rb +++ b/spec/controllers/concerns/remotely_translatable_spec.rb @@ -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