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:
...
</div>
<% if flash[:notice] -%>
<div id="notice" width=400 align=center><img
src="/images/gtk-info.png" > <%= flash[:notice]
%></div>
<% end %>
<div id="mainContent">
<%=@content_for_layout%>
</div>
...
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?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---