Sha256: 0cdbac16cf9f826b494be9eb90ae4eee2faaf9912cb1fa3af369a8dacac40902

Contents?: true

Size: 679 Bytes

Versions: 22

Compression:

Stored size: 679 Bytes

Contents

class Apiv1::Translations::CreateController < Admin::BaseController

  def create
    if _save_successful?
      _translation.save!
      render json: { translation: _translation_hash }
    else
      render json: { translation: _failure_hash }, status: :expectation_failed
    end
  end

  private
  def _save_successful?
    _translation.valid? 
  end

  def _translation
    @translation ||= Apiv1::Translation.new _translation_params
  end

  def _translation_params
    params.require(:translation).permit(:key, :locale, :translated_text, :value)
  end

  def _translation_hash
    _translation.to_ember_hash
  end

  def _failure_hash
    _translation.errors.to_h
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cloudrider-0.3.23 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.3.22 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.3.21 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.3.20 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.3.0 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.18 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.15 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.14 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.12 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.11 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.10 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.9 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.8 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.7 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.6 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.5 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.4 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.3 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.2 generica/app/controllers/apiv1/translations/create_controller.rb
cloudrider-0.2.1 generica/app/controllers/apiv1/translations/create_controller.rb