A deep dive into how Rails assembles the `params` object before a controller action runs. It covers the three sources of params — route/path params, query string params, and request body params — and explains the merge precedence (body < query < route). The post also covers nested params from bracket notation, JSON body parsing, the `_json` edge case, and how Strong Parameters filter the already-built structure. Practical debugging tips are included for common issues like missing params, key collisions, shape mismatches, and unparsed JSON bodies.
Table of contents
Let’s Get the Right Mental PictureThe Three Sources of paramsHow Nested Params Get Their ShapeStrong Parameters Come LaterDebugging When params Look WrongThe Point of All This228 Impressions