2013-04-28 43 views
0

我在rails中構建了一個應用程序,它在localhost上工作正常,但是當我推送到heroku時,路線變得混亂。我的routes.rb如下:用軌道推向Heroku時路徑和頁面出現問題

get "pages/index" 

get "sessions/new" 

resources :posts, :users 

match '/posts/new', to: 'posts#new' 
match '/posts/create', to: 'posts#create' 
match '/posts/:id', to: 'posts#show' 
match '/posts/index', to: 'posts#index' 
match '/posts/edit/:id', to: 'posts#edit' 
match '/posts/destroy/:id', to: 'posts#destroy' 
match 'admin', to: 'posts#admin' 
match 'login', to: 'sessions#new', :as => :sessions 
match '/index', to: 'pages/#about', :as => :index 

root :to => 'pages#index' 

我希望它根到頁面#索引,但在Heroku的路線是不同的不管是什麼原因,它的根歡迎#指數。

我的本地路由 enter image description here

我的Heroku路線

enter image description here

我刪除了歡迎控制器,從路徑文件刪除它,刪除在Heroku上的應用程序,並創建一個新的。

git remote rm heroku 
git add . 
git commit -a -m "removed welcome" 
heroku create --stack cedar 
git push heroku master 
heroku run rake db:migrate 

我仍然在歡迎#索引英雄的根。我嘗試在生產模式下運行本地服務器(rails s -e production)並且頁面顯示正確。我檢查了heroku日誌,並且沒有看到任何錯誤(除了DEPRECATION警告:你有插件在vendor/plugins中。這些插件的支持將在Rails 4.0中被移除,但這似乎不是錯誤導致路由問題)。

聽起來像是一個容易解決的問題,但我試過了所有我能想到的和我讀過的所有東西,包括多次刪除應用程序並重新啓動。幫助將不勝感激。

+1

你確定你在'master'分支做了修改嗎? – kiddorails 2013-04-28 19:48:46

+1

哇我是個白癡,我知道我錯過了一些東西。謝謝@kiddorails – agassi0430 2013-04-28 19:55:34

+0

沒問題。 :) – kiddorails 2013-04-28 19:57:45

回答

1

合併您的master分支,然後推送到Heroku。隨時都伴隨着我。

好運。