I am sending the parameters using post method to my rails server using this code in titanium-
if (email.value != '' && password.value != '')
{
loginReq.open("POST","http://192.168.0.187:3000/users/sign_in");
var params = {
email: email.value,
password: password.value
};
loginReq.send(params);
}
On rails server side I am getting this output on console -
Parameters: {"password"=>"[FILTERED]", "email"=>"[email protected]"}
But I need the output like this -
Parameters: {"user"=>{"email"=>"[email protected]", "password"=>
FILTERED]"}, "commit"=>"Sign in"}
How to add user
in parameters as above.
I don't necessarily see the value in it, but you could change this:
var params = {
email: email.value,
password: password.value
};
to this:
var params = {
user: {
email: email.value,
password: password.value
},
commit: "Sign In"
};
That would give you the output you're looking for.