2013-05-01 58 views
0

我構建了一個我在本地工作的Rails應用。在將其部署到我的虛擬主機後,我從sqlite更改爲mysql2並更新了其他一些gem。該應用在網絡主機上運行,​​但現在不在本地運行。我本地嘗試使用mysql2和sqlite。 如果我在開發(sqlite3)或生產(mysql2)中啓動rails服務器,我可以運行rake db:droprake db:createrake db:migrate。他們運行良好,我可以在數據庫瀏覽器或工作臺中確認。Rails應用RAKE ROUTES不返回任何東西

當我運行耙路線時,它找不到任何路線。

RAKE ROUTES --Trace 
** Invoke routes (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Execute routes 

以上是所有返回,當我瀏覽到我的應用程序的主網頁出現錯誤:

Internal Server Error: undefined method `info' for nil:NilClass 

什麼會導致耙路線忽略或沒有找到所有路由在routes.rb中?

下面是我的routes.rb文件。

MyApp::Application.routes.draw do 

get "users/new" 

get "answers/new" 

get "quizzes/new" 

get "flashcards/new" 

resources :posts do 
resources :comments 

resources :users 
resources :flashcards #, only: [:new, :create, :destroy] 
resources :sessions, only: [:new, :create, :destroy] 
resources :posts, only: [:new, :create, :destroy] 

    #get "users/enter" 

root :to => 'pages#home' 
match '/', :to => 'pages#home' 

match '/contact', :to => 'pages#contact' 
match '/about', :to => 'pages#about' 

match '/ghostx', :to => 'users#ghostx' 
match '/users/1', :to => 'users#ghostx' 

match '/enter', :to => 'sessions#new' 
match '/exit', :to => 'sessions#destroy' 

match'/flashcards', to: 'flashcards#index' 
match '/check', :to => 'flashcards#check' 
match '/flash', :to => 'flashcards#pullcard' 
match '/search', :to => 'flashcards#search' 
end 
+1

它曾經工作過嗎?如果是這樣,你能找到你所做的改變破壞了它嗎? – tadman 2013-05-01 04:22:53

+5

如何發佈你的'routes.rb'文件? – 2013-05-01 04:23:53

+0

是的,請張貼您的路線文件。其他人(感興趣的人)可以更好地幫助你。 – shayonj 2013-05-01 05:42:47

回答

1

您正在打開兩個街區,但只有一個end聲明。這個區塊在哪裏

resources :posts do 

應該關閉?