Module: ActiveFunction::Functions::StrongParameters

Defined in:
lib/active_function/functions/strong_parameters.rb

Overview

Allows manipulations with SuperBase#request via #params instance method and Parameters object.

Examples:

require "active_function"

ActiveFunction.config do
  plugin :strong_parameters
end

class PostsFunction < ActiveFunction::Base
  def index
    @response.body = permitted_params
  end

  def permitted_params
    params.require(:data).permit(:id, :name).to_h
  end
end

PostsFunction.process(:index, data: { id: 1, name: "Pupa" })

Defined Under Namespace

Classes: Parameters

Constant Summary collapse

Error =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#paramsParameters

Return params object with SuperBase#request.

Returns:



142
143
144
# File 'lib/active_function/functions/strong_parameters.rb', line 142

def params
  @_params ||= Parameters.new(@request, false)
end