This project is archived and is in readonly mode.

#3334 ✓resolved
andrew (at monsterboxpro)

Error Creating Helper Subdirectories

Reported by andrew (at monsterboxpro) | October 5th, 2009 @ 07:03 PM

Scenario

I'm running Rails 2.3.4

I have a helper for Tasks that's too cumbersome to manage. To solve the problem I create a subdirectory called 'tasks' and create helper files such as new_helper.rb, edit_helper.rb and etc..

Problem

When I start my app I get the following error

Expected /directory_to_rails_app/app/helpers/tasks/new_helper.rb to define Tasks::NewHelper

I have defined Tasks::NewHelper in a subdirectory called tasks.

Oberservations, and Quick Fixes

I think the problem has to do with having a helper named 'tasks_helper.rb' and having a subdirectory named 'tasks' at the same time.

While still having tasks_helper.rb and renaming subdirectory to anything else such as 'rockets', Rockets:NewHelper, there's no longer an error.

OR

Removing the tasks_helper.rb will also solve the problem, allowing you to have the subdirectory 'tasks'.

Comments and changes to this ticket

  • Mike Riley

    Mike Riley July 29th, 2010 @ 03:22 PM

    • State changed from “new” to “resolved”
    • Importance changed from “” to “”

    Hello Andrew,

    I believe the issue you may be seeing is that task is a reserved word in Rails (http://wiki.rubyonrails.org/rails/pages/reservedwords). Tasks::NewHelper seems to indicate that you have a class called Task? Due to the age of this ticket I am going to go ahead and close it out, but if you need further help on it, feel free to update it so we can help.

    Mike Riley

  • Engine

    Engine October 1st, 2010 @ 09:46 PM

    My app launched with application_controller "helper :all" throughs the following error :

    Expected /[...]/app/helpers/backoffice/content/articles_helper.rb to define Backoffice::Content::ArticlesHelper
    Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in load_without_new_constant_marking'<br/>

    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in `load_file'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:379:in `load_file'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:259:in `require_or_load'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:224:in `depend_on'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:136:in `require_dependency'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:126:in `helper'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:115:in `each'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:115:in `helper'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:120:in `helper'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:115:in `each'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/helpers.rb:115:in `helper'
    /Users/benoitmolenda/Documents/Dev/chateau_ravatys/app/controllers/application_controller.rb:5
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in `load_file'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:379:in `load_file'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:259:in `require_or_load'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:425:in `load_missing_constant'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:89:in `dispatch'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in `_call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in `call'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in `call'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in `cache'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in `call'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:in `call'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in `run'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:in `call'
    /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/rails/rack/static.rb:31:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'
    /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in `process'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
    /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in `run'
    /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111
    /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    ./script/server:3
    

    Dunno why but I feel somebody gonna say i'm not up to date...

    Anyway I checked that the file really exists using ls on "error given path".
    The name is not evolving in this bug cause If I erase articles_helper.rb then the same error appears with the sub folder next helper file.

    I stop to use helper :all for now cause I have plenty helpers.
    However this a real trouble.
    I began to get this error yesterday but strangely disappears without doing anything.
    Probably because of I let working the same mongrel all the time.
    But today I relaunched the ./script/server and the error stay.

    My app doesn't use any special tricks.
    I dunno if Routes are evolved in :all loading process but my app does like this :

    ActionController::Routing::Routes.draw do |map|
    map.namespace "backoffice", :path_prefix => "dashboard" do |back|

    back.namespace "content" do |content|
      content.resources :articles
      content.resources :feeds
      content.resources :pages
      etc
    

    Hope it could help or be enough to reproduce the bug.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages