javascript requests not being routed properly

I have a file in views/admin/contents/new.js that I would like to be
returned on a request from a script tag ex:
  <script src="http://localhost:3000/admin/pages/1/contents/new.js"
type="text/javascript"></script>

If I test out the js request manually, ie entering the js url in the
browser, I get the error shown below:

iso .. wrote:

I have a file in views/admin/contents/new.js that I would like to be
returned on a request from a script tag ex:
  <script src="http://localhost:3000/admin/pages/1/contents/new.js"
type="text/javascript"></script>

If I test out the js request manually, ie entering the js url in the
browser, I get the error shown below:
---------
Template is missing

Missing layout layouts/admin.js.erb in view path
/Users/chris/Documents/Projects/Rails/test_proj/app/views

---------

It is **Missing layout layouts/admin.js.erb** that I don't understand.
Why is this being routed in this way? It should be
admin/views/contents/new.js.

Thanks for the help.

I should add that I have no problem obtaining the js files if they are
not nested in a route, ie.

map.namespace do |admin|
  admin.resources :content_files
end

allows me to fetch the new js template file from
views/admin/content_files/new.js.erb

Has anyone else had this problem?