railstutorial.org第4章full_title_helper.rb导致RuntimeError(检测到循环依赖...)

时间:2014-02-21 20:27:53

标签: ruby-on-rails-4 railstutorial.org circular-dependency

当我遇到问题时,我正在通过Hartl的Ruby on Rail的教程第4章。我的项目在rails服务器中加载得很好,直到我添加了full_title_helper.rb文件。

我明白了:

  

RuntimeError(自动加载常量FullTitleHelper时检测到循环依赖关系):

     
    

app / controllers / application_controller.rb:1:在'top(required)'

中          

app / controllers / static_pages_controller.rb:1:in'top(required)'

  

我尝试按照this suggestion将config.middleware.delete Rack :: Lock添加到我的development.rb文件中,但这没有帮助。

我尝试从rails 4.0.2切换到4.0.0;那没用。

我的full_title_helper.rb直接来自Hartl's page

module ApplicationHelper

# Returns the full title with minor modifications depending on the page
def full_title(page_title)
    base_title = "Ruby on Rails Tutorial Sample App"
    if page_title.empty?
        base_title
    else
        "#{base_title} | #{page_title}"
    end
end
end

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

我的错误,我错误地命名了帮助文件。感谢任何看过这个问题的人。