所以我想在我的 Web 应用程序中使用 Devise,并且在 localhost 上测试一切正常,但是当我将它上传到我的 ec2 实例时,我收到错误'没有路由匹配 [GET]“/”',我没有知道如何解决这个问题。
这是我的 Routes.rb:
devise_for :users
resources :submissions
root to: 'home#index'
scope "api" do
get "/submissions(.:format)" => "submissions#index"
get "/submissions/:id(.:format)" => "submissions#show"
end
get "/submissions/:id/edit(.:format)" => "submissions#edit"
这是我的 Gemfile,请记住,我确实只用 gem:"devise" 尝试过,但这也不起作用。
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "devise", :git => "git://github.com/plataformatec/devise.git"
这是我的 ec2 实例上的 routes.rb:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
submissions GET /submissions(.:format) submissions#index
POST /submissions(.:format) submissions#create
new_submission GET /submissions/new(.:format) submissions#new
edit_submission GET /submissions/:id/edit(.:format) submissions#edit
submission GET /submissions/:id(.:format) submissions#show
PUT /submissions/:id(.:format) submissions#update
DELETE /submissions/:id(.:format) submissions#destroy
root / home#index
GET /api/submissions(.:format) submissions#index
GET /api/submissions/:id(.:format) submissions#show
GET /submissions/:id/edit(.:format) submissions#edit