Changing the URL if in nested resources

I have a nested restful resource working

map.resources :works do |work|
work.resources :work_sections

producing a url like:

I’d like to do two things with the URL, but am not sure where to start.

  1. I’d like to restrict the work_section from displaying if the work_id isn’t legit.
    Right now /works/2/work_sections/1 will pull up work_section_id 1 even if it is associated with work_id 1 (contrary to the url)

  2. Make it so that the work_section number in the URL is the :position (as opposed to :id) for the work_section which is an acts_as_list child of work.
    I want to avoid ending up with a url like: /works/223/work_sections/12838

I’m pretty sure accomplishing #2 will include my want for #1.

Is there an example or particular concept I need to look to research how to do this type of routing?

Check that in your controller code, make sure you use