开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜