2014-05-17 33 views
0

(滑轨3.1,Heroku的雪松,红宝石1.9.3,MacOSX的,蚀,GIT)设计用户定制导致MissingTemplate上的用户,索引作用在root_path在Heroku

我的应用程序被部署在Heroku雪松,和色器件登录图层在最新版本中运行良好,但用户路径现在引发了缺少的模板错误。它在我的开发机器上工作正常。

我对最新做出的两大改变是 - 1)从Devise生成用户模型/视图/控制器,以便我可以自定义。 2)为设计用户路径添加了路径前缀(即注册)

作为对Heroku的测试,将root_path更改为允许访问应用程序的不同控制器/索引(即messages_path)。一切工作,除点击主页链接,这将再次尝试去users_path(同样缺少模板错误):

<%= link_to image_tag("homeIcon.png"), users_path, :method =>"GET", :id =>"menulink", :title => "Go Home." %> 

我绝望任何洞察到这个问题,因为我想不出什么除了在Heroku上不使用Devise和Users这种方式。 任何和所有的想法,非常感谢!

感谢, 安妮

(注意研究:搜索上的错误信息,类似的问题,但没有约未能进入用户#指标,没有相关的设计和用户定制导致的错误消息的root_path;通过计算器ENGIN提出的审查问题清单)中的Eclipe

登录输出当地的发展:在Heroku

Started GET "/" for 127.0.0.1 
(0.2ms) SHOW search_path 
Processing by UsersController#index as HTML 
Redirected to [local-machine]/myprefix/users/sign_in 
... 
Started GET "/" for 127.0.0.1 at 2014-05-17 08:31:13 -0400 
Processing by UsersController#index as HTML 
User Load (0.3ms) SELECT "users".* FROM "users" 

登录输出。 用户登录,但users/index.html页面导致“对不起,但出错了”页面。

Started GET "/myprefix/users/sign_in" for ... 
heroku[router]: at=info method=GET path=/assets/application...dyno=web.1 
Rendered devise/sessions/new.html.erb within layouts/application (53.2ms) 
Processing by Devise::SessionsController#new as HTML 
cache: [GET /myprefix/users/sign_in] miss 
… 
heroku[router]: at=info method=POST path=/myprefix/users/sign_in 
host=myapp.herokuapp.com        
… 
Started POST "/myprefix/users/sign_in" 
Processing by Devise::SessionsController#create as HTML 
Parameters: {"utf8"=>"✓"... 
Redirected to http://myapp.herokuapp.com/ 
cache: [POST /myprefix/users/sign_in] invalidate, pass 
method=GET path=/ host=myapp.herokuapp.com request_id=f... 
Processing by UsersController#index as HTML 
Completed 500 Internal Server Error in 49ms 
Started GET "/" for ... 
ActionView::MissingTemplate (Missing template users/index, application/index 
with {:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}. 
Searched in: 
ActionView::MissingTemplate (Missing template users/index, application/index with 
{:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}. 
Searched in: 
* "/app/app/views" 
* "/app/vendor/bundle/ruby/1.9.1/gems/devise-2.2.8/app/views" 
): 
cache: [GET /] miss 
(no other output) 

File.properties shows location (i.e. eclipse ide) 
[path-to-my-rail-app]/app/views/users/index.html.erb 
[path-to-my-rail-app]/app/views/layouts/application.html.erb 

routes.rb 
MyApp::Application.routes.do 
devise_for :views 
devise_for :admins 
devise_for :users, :path_prefix => 'myprefix' 
resources :users do 
    resources :x, only: [:new, :create, :index, :edit,:destroy] 
    resources :y, only: [:new, :create, :index, :update, :destroy] 
    resources :z, only: [:new, :create, :index, :edit,:destroy,:update] do 
     get :q, :on => :member 
    end 
end 

rake routes output:

new_user_session GET  
     /myprefix/users/sign_in(.:format) 
     {:action=>"new", :controller=>"devise/sessions"} 
user_session POST 
     /myprefix/users/sign_in(.:format) 
     {:action=>"create", :controller=>"devise/sessions"} 
destroy_user_session DELETE 
     /myprefix/users/sign_out(.:format) 
     {:action=>"destroy", :controller=>"devise/sessions"} 
user_password POST 
     /myprefix/users/password(.:format) 
     {:action=>"create", :controller=>"devise/passwords"} 
new_user_password GET  
     /myprefix/users/password/new(.:format)  
     {:action=>"new", :controller=>"devise/passwords"} 
edit_user_password 
    GET  
     /myprefix/users/password/edit(.:format) 
     {:action=>"edit", :controller=>"devise/passwords"} 
    PUT /myprefix/users/password(.:format)     
     {:action=>"update", :controller=>"devise/passwords"} 
cancel_user_registration 
    GET /myprefix/users/cancel(.:format) 
     {:action=>"cancel", :controller=>"devise/registrations"} 
user_registration POST /myprefix/users(.:format) 
     {:action=>"create", :controller=>"devise/registrations"} 
new_user_registration GET  
     /myprefix/users/sign_up(.:format) 
     {:action=>"new", :controller=>"devise/registrations"} 
edit_user_registration GET 
     /myprefix/users/edit(.:format) 
     {:action=>"edit", :controller=>"devise/registrations"} 
    PUT /myprefix/users(.:format) 
     {:action=>"update", :controller=>"devise/registrations"} 
    DELETE /myprefix/users(.:format) 
     {:action=>"destroy", :controller=>"devise/registrations"} 

users GET /users(.:format) {:action=>"index", :controller=>"users"} 
     POST /users(.:format) {:action=>"create", :controller=>"users"} 
new_user GET /users/new(.:format)       
     {:action=>"new", :controller=>"users"} 
edit_user GET /users/:id/edit(.:format)      
     {:action=>"edit", :controller=>"users"} 
user GET /users/:id(.:format)       
     {:action=>"show", :controller=>"users"} 
    PUT /users/:id(.:format)       
     {:action=>"update", :controller=>"users"} 
    DELETE /users/:id(.:format)       
     {:action=>"destroy", :controller=>"users"} 
root  /            
     {:controller=>"users", :action=>"index"} 

的Gemfile: 源 'http://rubygems.org' 宝石 '捆绑' 红宝石 “1.9.2” 宝石 '轨道', '3.1.3' 宝石 'rails_12factor' ,组:::生产 gem'pg' gem'devise'

users_controller.rb:

class UsersController < ApplicationController 
    def index 
    @users = User.active_users 
    end 
end 

appliction.rb

require File.expand_path('../boot', __FILE__) 

require 'rails/all' 
require 'devise' 

回答

0

嗯,它是固定的,但以最奇怪的方式。感谢所有的stackexchange帖子给了我更多的见解,并感谢劳尔推动验证的想法。

对于任何被困在云中的人来说,这是它的要点。

1 - views/Users需要是views/users。不知何故,我的本地环境创建* U * sers。 整个/用户位置似乎被推送到heroku,但显然不是。

2 - (在Raul的问题之后,一小时试图找到heroku目录结构) 对/users/index.html做了一个简单的打字错误更改,以查看当我尝试提交它时是否有错误。 在commit(eclipse git窗口)期间,我注意到项目浏览器中的文件名在整个时间都在'用户/'和'用户之间弹出。

一旦git提交完成,我又做了另一个heroku push master,问题就解决了。我现在登陆/users/index.html

感谢大家的保存,我喜欢这个网站。

安妮

0

显然,你的应用程序无法找到users/index.html.erb文件。

你能确认该文件是否存在,并且它已被推送到生产?

+0

我对heroku相当陌生,无法找到如何验证服务器上的文件。我所要做的就是git仓库。 Heroku在说“一切都是最新的”。 我正在寻找heroku CLI,但找不到任何东西。 – user3647592

相关问题