简体   繁体   中英

Rails App RAKE ROUTES does not return anything

I built a rails app that I had working locally. In deploying it to my web host, I changed from sqlite to mysql2 and updated some other gems. The app is up on the web host, but now it doesn't run locally. I've tried locally to use mysql2 and sqlite. If I start the rails server in development (sqlite3) or production (mysql2), I can run rake db:drop rake db:create rake db:migrate . They run fine and I can confirm this in database browser or workbench.

When I run rake routes it doesn't find any routes.

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

The above is all that is returned and when I browse to the main page of my application I get the error:

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

What would cause Rake Routes to ignore or not find all the routes in routes.rb?

Below is my routes.rb file.

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

You are opening two blocks but only have one end statement. Where is this block

resources :posts do

supposed to close?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM