Sha256: a1787964f830e16dba30e3a2a3d6cc3ed9f7242c90cf8de0235cbbd82c6ea83e

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

class RequestHandlerController < ActionController::Base
  private

  def document_params
    params.require(:document).permit(:name)
  end

  def documents
    Document.all
  end

  def document
    @document ||= documents.find(params.require(:id))
  end

  def add_magic_reference
    document.reference = 'X-MAGIC-15'
  end

  def add_magic_reference_and_trigger
    document.update(reference: 'X-MAGIC-15')
    Worker.perform(document.id)
  end

  def build_magic_document
    documents.where(reference: 'X-MAGIC-15')
             .build(document_params)
  end

  def add_bang_name
    document.assign_attributes(document_params)
    document.name = "#{document.name}!"
    document.save
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
azeroth-1.0.0 spec/support/app/controllers/request_handler_controller.rb
azeroth-0.10.1 spec/support/app/controllers/request_handler_controller.rb
azeroth-0.10.0 spec/support/app/controllers/request_handler_controller.rb
azeroth-0.9.0 spec/support/app/controllers/request_handler_controller.rb