首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails Actionpack:错误的参数类型类(预期模块) (TypeError)

Rails Actionpack:错误的参数类型类(预期模块) (TypeError)
EN

Stack Overflow用户
提问于 2016-01-17 17:26:06
回答 1查看 2.3K关注 0票数 1

我在Rails和heroku上遇到了这个问题:在我的pc上,一切都正常工作,但是heroku上的同一个应用程序不能工作,因为这个错误:

代码语言:javascript
复制
/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:180:in `include': wrong argument type Class (expected Module) (TypeError)

在这里,我粘贴完整的堆栈跟踪:

代码语言:javascript
复制
$: heroku run rails console
Running rails console on myapp... up, run.4782
/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:180:in `include': wrong argument type Class (expected Module) (TypeError)
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:180:in `block in add_template_helper'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:180:in `module_eval'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:180:in `add_template_helper'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:109:in `block in helper'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:108:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/helpers.rb:108:in `helper'
    from /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_controller/railties/helpers.rb:17:in `inherited'
    from /app/app/controllers/application_controller.rb:1:in `<top (required)>'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:360:in `require_or_load'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:317:in `depend_on'
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:233:in `require_dependency'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `block in eager_load!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `eager_load!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:346:in `eager_load!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
    from /app/config/environment.rb:5:in `<top (required)>'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:328:in `require'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:67:in `console'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
    from /app/bin/rails:8:in `require'
    from /app/bin/rails:8:in `<main>'

我不知道那是什么!

能帮我个忙吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-17 21:44:52

错误表明其中一个助手文件被定义为类而不是模块。

代码语言:javascript
复制
class ApplicationHelper
end

vs.

module ApplicationHelper
end
票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34841292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档