ruby - getting value of hash from params -


i know better way extract hash value params. params looks below (remember params name 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 value of "creative_template_id" params.

i being able value executing below code:

params[:ad_template][:ad_creative_templates_attributes].first.second[:creative_template_id] 

which gives me value 2430 correct don't approach. know better solution extract value params.

thanks.

how about:

params[:ad_template][:ad_creative_templates_attributes]['0'][:creative_template_id] 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -