Re:Why Learning to Code Is So Damn Hard
by troels on Wednesday February 04, 2015 @06:11PM
(#9000697)
I have to agree - The path helpers are very opaque. It would probably do Rails well to generate a app/helpers/path_helper.rb file with the actual implementations in them.
[ Parent
| on HN ]
Re:Why Learning to Code Is So Damn Hard
by hwhelchel on Thursday February 05, 2015 @02:09AM
(#9002106)
`rake routes` will output the routes and paths. Appending _path or _url to the path will generate appropriate methods.
Sure. But that still doesn't tell me exactly which arguments they take. Or give me an opportunity to debug the code when it doesn't do as I expect. I realise that it just-works (tm). It's when it doesn't, it gets problematic.
Re:Why Learning to Code Is So Damn Hard
by epochwolf on Thursday February 05, 2015 @02:36PM
(#9005383)
It's actually pretty easy to tell the parameters they take if you look at the url for the route.
For:
story GET /story/:id(.:format) story#show
You get story_path(id)
story_path(id, format)
story_url(id)
story_url(id, format)
In practice it doesn't cause as many problems as you think, even in large applications.