我当然为此而失去理智/睡眠。这是我的 questions_controller.rb
class QuestionsController < ApplicationController
# GET /questions
# GET /questions.json
def index
@questions = Question.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @questions }
end
end
这是我的 applications_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery
end
这是我的 rake 路线:
questions GET /questions(.:format) questions#index
POST /questions(.:format) questions#create
new_question GET /questions/new(.:format) questions#new
edit_question GET /questions/:id/edit(.:format) questions#edit
question GET /questions/:id(.:format) questions#show
PUT /questions/:id(.:format) questions#update
DELETE /questions/:id(.:format) questions#destroy
home_index GET /home/index(.:format) home#index
这是我的路线.rb
App::Application.routes.draw do
resources :questions
end
前往时出错http://0.0.0.0:3000/questions
uninitialized constant QuestionsController
可能是什么错误?