Class: InlineTranslation::Controllers::TranslationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/translations_controller.rb', line 6

def create
  if service.translate(translatable, to: to_language)
    @translations = translatable.translations.where(language: to_language)
    respond_to do |format|
      format.js { render :create }
      format.json { render json: @translations } # TODO: support for AMS / custom serialization
    end
  else
    failure_response
  end
end