From c8d3c8fc1b5720e8a6a91df59c37af19ce323700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 18 Oct 2018 00:34:27 +0200 Subject: [PATCH] Use `detect` instead of `select.first` --- app/helpers/translatable_form_helper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/helpers/translatable_form_helper.rb b/app/helpers/translatable_form_helper.rb index 8ab619634..4c46e0507 100644 --- a/app/helpers/translatable_form_helper.rb +++ b/app/helpers/translatable_form_helper.rb @@ -37,9 +37,7 @@ module TranslatableFormHelper end def existing_translation_for(locale) - # Use `select` because `where` uses the database and so ignores - # the `params` sent by the browser - @object.translations.select { |translation| translation.locale == locale }.first + @object.translations.detect { |translation| translation.locale == locale } end def new_translation_for(locale)