Make private methods private

This commit is contained in:
Javi Martín
2018-10-11 12:03:35 +02:00
parent 7479223d59
commit 1255aa5032

View File

@@ -25,24 +25,24 @@ module TranslatableFormHelper
end.join.html_safe
end
def translation_for(locale)
existing_translation_for(locale) || new_translation_for(locale)
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
end
def new_translation_for(locale)
@object.translations.new(locale: locale).tap do |translation|
translation.mark_for_destruction unless locale == I18n.locale
end
end
private
def translation_for(locale)
existing_translation_for(locale) || new_translation_for(locale)
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
end
def new_translation_for(locale)
@object.translations.new(locale: locale).tap do |translation|
translation.mark_for_destruction unless locale == I18n.locale
end
end
def translations_options(resource, locale)
{
class: " js-globalize-attribute",