Template is missing

Wu Chang
Fri, 13 Jun 2008 09:34:09 -0000

I meet a strange problem, my application works well on development
environment, but when I switch it to production environment, a strange
problem of ''Template is missing'' ,which have troubled me for
several
days.

following is my code:

1.routes.rb:
  map.index '''', :controller  => ''web'',
:action => ''index''
  map.namespace :admin do |admin|
      # Directs /admin/products/* to Admin::ProductsController
(app/controllers/admin/products_controller.rb)
       admin.resources :users,:categories
  end
  map.connect '':controller/:action/:id''
  map.connect '':controller/:action/:id.:format''

2.app/controller/admin/users_controller.rb
class Admin::UsersController < ApplicationController
  layout "administrator"
  before_filter  :authorize

  def index
    @users = User.paginate :per_page=> PER_PAGE,
      :page=>params[:page]||1,
      :conditions =>["login_name like ?
","%#{params[:login_name]}%"],
      :order=> ''created_at desc''
  end

  def new
    @user = User.new
  end
.....
end

3.app/view/layouts/administrator.rhtml:

...

<% if flash[:notice] -%>
<img
src="/images/gtk-info.png" >&nbsp;<%= flash[:notice]
%>
<% end %>

  <%=@content_for_layout%>

...

4.app/view/admin/index.html.erb is existed.
5.app/view/admin/index.html.erb is existed.

When I first browse ''http://localhost:3000/admin/users'', it
works, but
when I click the link ''http://localhost:3000/admin/users/new''
on the
page, the error appeared.following is the information:
"Missing template admin/users/index/new.html.erb in view path
C:/rails-projects/school/app/views
".
when I removed the code "layout ''administrator''" in
users_controller.rb,
it works. but why?? It puzzled me.I can''t find which part is wrong
between template and routes. can u give me the answer?