I’ve come across some code in a view that on includes a path helper in the format…
edit_company_url(:format => 'json')
What jumps out at me is that there’s no @company argument being passed to the helper. There is, however, a @company variable declared in the controller. When I load the page in a browser, the url is being correctly generated. I’ve never seen this before, but can helpers magically figure out the id without it being explicitly passed when an appropriately named instance variable is available?
I came across this code trying to write a view spec than renders this view, and the spec croaks on this exact helper call due to not being able to find the route without the ID, but I’ll save that part of the question for the TDD category once I’ve figured out why this works as written in the browser.