Handling a nested params hash in a Rails3 route matcher


I am writing a custom matcher in routes.rb. I wish to map a dynamic
segment to a nested params hash. I cannot seem to determine how to pass
the value of the dynamic segment to a nested hash.

The code that I have is:

get "(/:path)/:pars",
  :action => :create,
  :controller => :customs_shipment_pars_checks,
  :ca_customs_manifest => { :ccdn  => :pars }

This passes params[:ca_customs_manifest][:ccdn] == :pars # a symbol
and params[:pars] == “somevalue”

changing the last line to:

  :ca_customs_manifest => { :ccdn  => %(pars) }

This passes params[:ca_customs_manifest][:ccdn] == pars # a string
and params[:pars] == “somevalue”

What I wish to do is to pass the dynamically assigned value of :pars to
the nested hash. How is this done?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs