I would like to know the better way to extract hash value from params. The params looks like below (remember my params name is params[:ad_template]):
{"name"=>"name",
"description"=>"description",
"tag_list"=>"Software Development",
"objective"=>"VIDEO_VIEW",
"ad_creative_templates_attributes"=>{
"0"=>{"creative_template_id"=>"2430", "_destroy"=>"false"}
},
"ad_target_templates_attributes"=>{
"0"=>{"target_template_id"=>"1526", "_destroy"=>"false"}
}
}
Now i would like to get the value of "creative_template_id" from this params.
I am being able to get this value by executing below code:
params[:ad_template][:ad_creative_templates_attributes].first.second[:creative_template_id]
Which gives me the value 2430 which is correct but i don't like this approach. SO i would like to know the better solution to extract that value from the params.
Thanks.