rails
https://github.com/rails/rails
Ruby
Ruby on Rails
ActionController::Parameters#to_hash
Returns a safe <tt>Hash</tt> representation of the parameters with all unpermitted keys removed. params = ActionController::Parameters.new({ name: "Senjougahara Hitagi", oddity: "Heavy stone crab" }) params.to_hash # => ActionController::UnfilteredParameters: unable to convert unfiltered parameters to hash safe_params = params.permit(:name) safe_params.to_hash # => {"name"=>"Senjougahara Hitagi"}
Edit
git clone [email protected]:rails/rails.git
cd rails
open actionpack/lib/action_controller/metal/strong_parameters.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-ActionController--Parameters-to_hash-for-pr
# Commit to gitgit add actionpack/lib/action_controller/metal/strong_parameters.rbgit commit -m "better docs for ActionController::Parameters#to_hash"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-ActionController--Parameters-to_hash-for-pr
hub pull-request
# Celebrate!