Skip to content

Instantly share code, notes, and snippets.

@alienxp03
Last active August 29, 2015 14:26
Show Gist options
  • Save alienxp03/a1e01c6651785c8ab302 to your computer and use it in GitHub Desktop.
Save alienxp03/a1e01c6651785c8ab302 to your computer and use it in GitHub Desktop.
# 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