- Nested route parameters are remembered
If you’re in a controller action and you get there via a nested route, any path helpers you call automagically get the ID of the resource you’re nested under. The route helpers reverse-merge in the parameters of the request.
This means if you have these routes:
resources :magazines do
and you’re in an action in the ads controller, nested under magazine 5, you can do this:
without passing in a magazine object. It will pull magazine_id 5 out of the request parameters.
- (1..100).grep 38..44
[38, 39, 40, 41, 42, 43, 44]
As per ruby enumerable docs.
This is because grep uses threequel, which on a range is defined as inclusion. Answer courtesy of Giles Bowkett