Last active
August 29, 2015 14:26
-
-
Save alienxp03/a1e01c6651785c8ab302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assigning the hash | |
person = {} | |
person["person"] = params.to_hash | |
# hash output as off right now | |
{"person"=> | |
{"email"=>"[email protected]", | |
"given_name"=>"given name", | |
"family_name"=>"last name", | |
"username"=>"username1", | |
"password"=>"password", | |
"terms"=>true} | |
} | |
# send the request | |
RestClient::Request.execute(method: :post, | |
url: "#{request.base_url}/people", | |
timeout: 5, headers: {params: person}) | |
#hash output on controller /people/create | |
{"person"=> | |
"{\"email\"=>\"[email protected]\", \"given_name\"=>\"given name\", \"family_name\"=>\"last name\", \"username\"=>\"username1\", \"password\"=>\"password\", \"terms\"=>true}", | |
"action"=>"create", | |
"controller"=>"people"} | |
# how to make sure that the hash does not change since i want to access it like person[:email] ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment