From c3953ac6517c3626a7c75710405696fef6692357 Mon Sep 17 00:00:00 2001
From: Roman Samoilov <2270393+rsamoilov@users.noreply.github.com>
Date: Wed, 12 Feb 2025 17:18:32 +0000
Subject: [PATCH] Update Strong Params example
---
lib/rage/controller/api.rb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/rage/controller/api.rb b/lib/rage/controller/api.rb
index a28e326..5538feb 100644
--- a/lib/rage/controller/api.rb
+++ b/lib/rage/controller/api.rb
@@ -585,27 +585,27 @@ def request_http_token_authentication
if !defined?(::ActionController::Parameters)
# Get the request data. The keys inside the hash are symbols, so `params.keys` returns an array of `Symbol`.
- # You can also load Strong Params to have Rage automatically wrap `params` in an instance of `ActionController::Parameters`.
+ # You can also load Strong Parameters to have Rage automatically wrap `params` in an instance of `ActionController::Parameters`.
# At the same time, if you are not implementing complex filtering rules or working with nested structures, consider using native `Hash#fetch` and `Hash#slice` instead.
#
# For multipart file uploads, the uploaded files are represented by an instance of {Rage::UploadedFile}.
#
# @return [Hash{Symbol=>String,Array,Hash,Numeric,NilClass,TrueClass,FalseClass}]
- # @example
- # # make sure to load strong params before the `require "rage/all"` call
- # require "active_support/all"
- # require "action_controller/metal/strong_parameters"
+ # @example With Strong Parameters
+ # # in the Gemfile:
+ # gem "activesupport", require: "active_support/all"
+ # gem "actionpack", require: "action_controller/metal/strong_parameters"
#
- # params.permit(:user).require(:full_name, :dob)
- # @example
- # # without strong params
+ # # in the controller:
+ # params.require(:user).permit(:full_name, :dob)
+ # @example Without Strong Parameters
# params.fetch(:user).slice(:full_name, :dob)
def params
@__params
end
else
def params
- @params ||= ActionController::Parameters.new(@__params)
+ @__params__ ||= ActionController::Parameters.new(@__params)
end
end