所以我的应用程序在我的本地机器上运行完美,我成功地将它推送到github和heroku但是当我尝试在浏览器中打开应用程序时,我收到以下错误:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Run Code Online (Sandbox Code Playgroud)
然后我尝试跑步
$ heroku logs
Run Code Online (Sandbox Code Playgroud)
我在控制台中获得以下输出:
2012-07-05T21:52:11+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:52:33+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:53:33+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:53:55+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:58:45+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:59:04+00:00 heroku[slugc]: Slug compilation failed: failed …Run Code Online (Sandbox Code Playgroud) 所以我一直遇到以下错误:
No route matches {:action=>"show", :controller=>"users"}
我尝试运行rake路由,我可以看到路由存在:
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
Run Code Online (Sandbox Code Playgroud)
但每次我尝试访问该页面"/users/1"(1为用户ID)时,我都会收到上述错误.有任何想法吗?谢谢!
这是我的routes.rb:
SampleApp::Application.routes.draw do
root to: 'static_pages#home'
resources :users
resource :sessions, only: [:new, :create, :destroy]
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
Run Code Online (Sandbox Code Playgroud)
这是我的users_controller.rb:
class UsersController < ApplicationController
before_filter :signed_in_user, only: [:index, :edit, :update]
before_filter :correct_user, only: [:edit, :update] …Run Code Online (Sandbox Code Playgroud)