Class: AwesomeTranslations::DuplicatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AwesomeTranslations::DuplicatesController
- Defined in:
- app/controllers/awesome_translations/duplicates_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/awesome_translations/duplicates_controller.rb', line 13 def create ids = [] params[:d].each do |translation_value_id, check_value| ids << translation_value_id.to_i if check_value == "1" end translation_values = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue .where(id: ids) translation_values.each do |translation_value| AwesomeTranslations::TranslationMigrator.new(translation_value: translation_value).execute translation_value.destroy! end redirect_back(fallback_location: :root) end |
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'app/controllers/awesome_translations/duplicates_controller.rb', line 2 def index @duplicates = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue .select("translation_values.*, duplicate_translation_values.id AS duplicate_id") .joins(" INNER JOIN translation_values AS duplicate_translation_values ON duplicate_translation_values.translation_key_id = translation_values.translation_key_id ") .where("translation_values.id < duplicate_translation_values.id") .where("translation_values.locale = duplicate_translation_values.locale") end |