Sha256: 2992527106afe7f07ebd0940d2f5e89b652161d72d7a47cb8e1d25903f391d56

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true

module Azeroth
  class RequestHandler
    # @api private
    #
    # hadler for requests to update resource
    class Update < RequestHandler
      private

      # @private
      #
      # Updates and return an instance of the model
      #
      # update uses the method +"#{model.name}_params"+ to
      # fetch all allowed attributes for update
      #
      # @return [Object]
      def resource
        attributes = controller.send("#{model.name}_params")
        resource = controller.send(model.name)
        resource.update(attributes)
        resource
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azeroth-0.2.0 lib/azeroth/request_handler/update.rb
azeroth-0.1.0 lib/azeroth/request_handler/update.rb