Sha256: 417b59750647900bf9c86d51eaa887d07231a1a2e9daa3a37b59a65337f69deb

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Account
  class NotesController < Account::BaseController
    before_action :build_note
    skip_before_action :verify_authenticity_token

    respond_to :json

    def create
      @note.order_id = params[:part_id] if params[:part_id].present?
      @note.order_id ||= params[:order_id]
      begin
        @note.submit if @note.valid?
      rescue JsonApiClient::Errors::ApiError
        @note.errors.add('content', :invalid)
      end
      respond_with(@note, location: account_order_path(@note.order_id))
    end

    private

    def build_note
      @note = Account::NoteForm.new(params[:note])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/controllers/account/notes_controller.rb