控制器中的NameError,结尾为'y'

时间:2016-01-15 09:37:49

标签: ruby-on-rails rails-routing

启动页面localhost:3000 / ticker_activities我在TickerActivitiesController中得到一个NameError

  

未初始化的常量TickerActivitiesController :: Ticker_Activity

应用/控制器/ ticker_activities_controller.rb:

class TickerActivitiesController < ApplicationController
  ...
  def index
    @ticker_activities = Ticker_Activity.all

    ...

配置/ routes.rb中

resources :ticker_activities

模型/ ticker_activity.rb

class TickerActivity < ActiveRecord::Base

路线

ticker_activities GET    /ticker_activities(.:format)                 ticker_activities#index
                                  POST   /ticker_activities(.:format)                 ticker_activities#create
              new_ticker_activity GET    /ticker_activities/new(.:format)             ticker_activities#new
             edit_ticker_activity GET    /ticker_activities/:id/edit(.:format)        ticker_activities#edit
                  ticker_activity GET    /ticker_activities/:id(.:format)             ticker_activities#show
                                  PUT    /ticker_activities/:id(.:format)             ticker_activities#update
                                  DELETE /ticker_activities/:id(.:format)             ticker_activities#destroy

我尝试了'Ticker_Activities.all','Ticker_Activitie.all','Ticker_Activiti.all'。没有任何效果。

这可能是因为这与'y' - '结束活动/活动有关吗?

谢谢你的帮助!

1 个答案:

答案 0 :(得分:2)

  

未初始化的常量TickerActivitiesController :: Ticker_Activity

您需要更改

@ticker_activities = Ticker_Activity.all

@ticker_activities = TickerActivity.all