未定义的局部变量或方法`ho'用于#<actiondispatch :: routing :: mapper:0x00000103f4d0e0>(NameError)</actiondispatch :: routing :: mapper:0x00000103f4d0e0>

时间:2015-01-17 07:51:36

标签: ruby-on-rails ruby-on-rails-4

我有以下路线档案:

Rails.application.routes.draw do

  get 'home', controller:'home', action: :feeds

  get 'user/add'

  get 'user/delete'

  get 'user/update'

  get 'user/list',controller:'event', action: :list

  get 'user/login'

  get 'user/logout'

  post 'user/isloggedin'

  get 'timeline/add'

  get 'timeline/list'

  resources :action_items


  get 'events/edit'
  get 'events/delete'
  get 'event/list'
  get 'event/details/:id', controller:'event', action: :details
  get 'event/fetch/', controller:'event', action:ho

  post 'event/add', controller:'event', action: :add
  post 'event/update', controller:'event', action: :update
  post 'event/updateeventdata', controller:'event', action: :update_event_data

  get 'timeline/list', controller:'timeline', action: :list
  post 'timeline/add', controller:'timeline', action: :add
  post 'timeline/update', controller:'timeline', action: :update
  post 'timeline/delete', controller:'timeline', action: :delete




  get 'correspondence/list', controller:'correspondence', action: :list
  post 'correspondence/add', controller:'correspondence', action: :add
  post 'correspondence/update', controller:'correspondence', action: :update
  post 'correspondence/delete', controller:'correspondence', action: :delete

  get 'actionitem/:id', controller:'action_items', action: :index
  post 'actionitem/update', controller:'action_items', action: :update

  get 'admin', controller:'admin', action: :index

end

在运行服务器时,我收到以下错误:

  

block in <top (required)>': undefined local variable or method ho'中#   (NameError)

虽然我在控制器中定义了方法。我错过了什么?

1 个答案:

答案 0 :(得分:3)

你有一个错字。

get 'event/fetch/', controller:'event', action:ho

-> get 'event/fetch/', controller:'event', action: :ho