Passing Params To Before Filters

Ran across something I never did today. I needed to pass in a param which changed based on whether the route was nested or not. So I could have something like /foo/1 and /foo/1/bar/2.

I am really after what the first number after foo is so I can verify something in my before filter. In the first example /foo/1 the param being passed to the controller is :id. In the second example /foo/1/bar/2 the param is :foo_id.

After some digging I found the info I was looking for on the Rails Guides and came up up with this: All my cucumber and rspec tests are green and I feel good!