Sha256: 813258fcbb435a55f147bf0ae1efaab34cc472d57d7dc81b369485d00a649a3c

Contents?: true

Size: 911 Bytes

Versions: 13

Compression:

Stored size: 911 Bytes

Contents

class AwesomeTranslations::MigrationsController < AwesomeTranslations::ApplicationController
  def new; end

  def create
    params[:m].each do |translation_value_id, check_value|
      next unless check_value == "1"

      translation_value = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue.find(translation_value_id)
      translation_value.migrate_to_awesome_translations_namespace!
    end

    redirect_to new_migration_path
  end

private

  helper_method :translations_to_migrate
  def translations_to_migrate
    @translations_to_migrate ||= AwesomeTranslations::CacheDatabaseGenerator::TranslationValue
      .joins(:translation_key)
      .includes(:translation_key)
      .joins("INNER JOIN handler_translations ON handler_translations.translation_key_id = translation_keys.id")
      .where("translation_values.file_path NOT LIKE '%/config/locales/awesome_translations/%'")
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
awesome_translations-0.0.66 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.65 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.64 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.63 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.62 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.61 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.60 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.59 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.58 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.57 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.56 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.55 app/controllers/awesome_translations/migrations_controller.rb
awesome_translations-0.0.54 app/controllers/awesome_translations/migrations_controller.rb