Did you look in the params hash that is sent from your form when you submit it? What's the very last element in the params (usually, and in a scaffolded demo, always)? Note: I am speaking of the params you would get in an update (PATCH), not a create (POST), as you asked specifically about the id, and a POST won't have one of those.
Walter
> On Jun 4, 2018, at 4:31 AM, fugee ohu <fugee279@gmail.com> wrote:
>
> How do forms pass the id to the controller in normal basic scaffolding? There's no id field in the form, there's no magic that passes the form's container object to the controller, rather every parameter is explicity provided in input fields of the form, except the id, so how does the id get passed to the controller? Something in the forms syntax extracts the id from the @object and puts it in the form but i dunno what Thanks in advance
>
> --
> 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-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7cb29d22-b82a-4101-aaa3-a054a556dfdf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/EC4F4C5D-0EF2-490A-85AB-E16FE34C9539%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment