Path 生成的路径已停止工作

Path 生成的路径已停止工作,path,routes,ruby-on-rails-3.2,Path,Routes,Ruby On Rails 3.2,我正在使用Rails 3.2.5创建一个博客,并一直使用路由生成的资源路径(即对于我的code\u条目:code\u条目路径,new\u code\u条目路径等)将链接到每个操作。每当我试图访问某个页面时,突然出现以下错误: undefined local variable or method `controller' for #<CodeEntriesController:0x007f887f8b3300> /code\u entries/index.html.haml

我正在使用
Rails 3.2.5
创建一个博客,并一直使用路由生成的资源路径(即对于我的
code\u条目
code\u条目
路径,
new\u code\u条目
路径等)将
链接到每个操作。每当我试图访问某个页面时,突然出现以下错误:

undefined local variable or method `controller' for #<CodeEntriesController:0x007f887f8b3300>


/code\u entries/index.html.haml



routes.rb



代码项中的名称错误#索引

显示/Users/kyle/Projects/blog/app/views/code_entries/index.html.haml,其中第4行出现:

undefined local variable or method `controller' for #<CodeEntriesController:0x007f887f813418>
应用程序跟踪|框架跟踪|完整跟踪

app/views/code_entries/index.html.haml:4:in `block in _app_views_code_entries_index_html_haml___3334012984247114074_70112115764360'
app/views/code_entries/index.html.haml:3:in `_app_views_code_entries_index_html_haml___3334012984247114074_70112115764360'
Request
参数:

None
显示会话转储

显示环境转储

回应

标题:

None

我在
application\u controller.rb中创建了一个方法,并将其用作
helper\u方法的参数。由于它位于
application\u controller.rb
中,而不是
application\u helper.rb
中,因此我使用了标记
include ActionView::Helpers::UrlHelper
,因此我可以在helper方法中使用链接。不知怎的,
include
语句让它爆炸了,但有一次我删除了
include
语句,将helper方法移到了
application\u helper.rb
中,一切都很好

1: %h1 Hello!
2: %br
3: - @entries.each do |e|
4:   %h2= link_to e.title, code_entry_path(e)
5:   %h3= e.updated_at
6:   = raw excerpt(e, 200)
7:   %br
Rails.root: /Users/kyle/Projects/blog
app/views/code_entries/index.html.haml:4:in `block in _app_views_code_entries_index_html_haml___3334012984247114074_70112115764360'
app/views/code_entries/index.html.haml:3:in `_app_views_code_entries_index_html_haml___3334012984247114074_70112115764360'
Request
None
None