What may cause request parameters to appear as nested parameters

9 views
Skip to first unread message

fugee ohu

unread,
Apr 20, 2017, 6:00:18 AM4/20/17
to Ruby on Rails: Talk
Here my params are nested utf8 wraps press_release which in turn wraps venue, venue_country, etc.
What causes this behavior?

{"utf8"=>"✓",
 "authenticity_token"=>"qR82bEuyDUS6XD1dxylozc96nGH0kxk/ew+sUe95LT9s+8G9PJqAr06khj0bE9SEPElcinsWxe0Kgzppzq1g0w==",
 "press_release"=>
  {"venue"=>"",
   "venue_country"=>"US",

Walter Lee Davis

unread,
Apr 20, 2017, 8:05:00 AM4/20/17
to rubyonra...@googlegroups.com
utf8 and authenticity_token are at the "root" level of the params hash, at the same level as press_release. They are peers. Press release contains two child attributes and their values, because that's the way your form was set up. By default, when you use

<%= form_for @foo do | f | %>

to start off your form, you are going to get a set of parameters like

{ ... "foo" => { "name" => "Bar", "style" => "Baz" } ... }

in return.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3538a0ba-4671-4fca-99b5-7d56583b39d8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

fugee ohu

unread,
Apr 20, 2017, 9:52:58 AM4/20/17
to Ruby on Rails: Talk
Thanks 
Reply all
Reply to author
Forward
0 new messages