Rails 3 NameError Uninitialized Constant EventsController::Events
开发者_运维百科Ok so I made a model, controller, and some views for an 'Event' (didn't use scaffolding).
Anyways when going to the events route I get this error:
uninitialized constant EventsController::Events
app/controllers/events_controller.rb:4:in `index'
This is my events controller:
class EventsController < ApplicationController
def index
@events = Events.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @events }
end
end
end
Any thoughts on why this isn't working?
You probably want Event.all
, not Events.all
. (When calling your model class directly, always use the singular form)
精彩评论