Reputation: 36394
I am certainly losing my head/sleep over this. This is my 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
This is my applications_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery
end
This is my rake routes:
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
This is my routes.rb
App::Application.routes.draw do
resources :questions
end
Error on going to http://0.0.0.0:3000/questions
uninitialized constant QuestionsController
What might be the error?
Upvotes: 0
Views: 78
Reputation: 864
Can you make sure the controller filename is in correctly plural form?
app/controllers/questions_controller.rb
Thanks.
Upvotes: 0
Reputation: 40492
This kind of errors sometimes happen when there is a syntax error in one of files. Restart your dev server and look up for errors in its output.
Especially check line
format.html # index.html.erb
I don't think it can be written this way.
Upvotes: 1