In a specific controller I have the below list of params:
Parameters: {"user"=>"{\"id\":32,\"email\":\"[email protected]\",\"created_at\":\"2014-04-10T13:13:40.000Z\",\"updated_at\":\"2014-04-11T18:10:15.000Z\"}"}
How I can get the value of email for example?
You can do
params[:user][:email] #=> "[email protected]"
Which gives you the params of email
attribute of user
.
You value looks like json.
So try this
user_params = ActiveSupport::JSON.decode(params[:user])
user_params[:email]
or
require 'json'
user_params = JSON.parse(params[:user])
user_params[:email]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With