gpt4 book ai didi

ruby-on-rails - 从 Rails 2 升级到 Rails 3(以及 ruby​​ 版本)时出现问题

转载 作者:行者123 更新时间:2023-12-04 06:12:14 27 4
gpt4 key购买 nike

我在从 Rails 2.3.10 升级到 Rails 3 时遇到问题我正在升级一个现有的项目,我所做的是创建一个全新的 Rails 3.0.9 项目副本,覆盖代码(模型、 View 等...)并更改 Rails_upgrade 插件推荐的内容。

此外,我还升级了 gem 等..

现在,当我尝试启动服务器时遇到此问题:

/Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `include': wrong argument type Class (expected Module) (TypeError)
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `add_template_helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `module_eval'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `add_template_helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:98:in `helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:97:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:97:in `helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/action_controller/base.rb:228:in `inherited'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/bundler/gems/typus-974c0c36221d/app/controllers/admin/base_controller.rb:1
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:491:in `load_missing_constant'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:183:in `const_missing'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in `const_missing'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/bundler/gems/typus-974c0c36221d/app/controllers/admin/account_controller.rb:1
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:138:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:137:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:137:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:135:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:135:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:209:in `to_proc'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application/railties.rb:11:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application/railties.rb:11:in `all'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:107:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application/finisher.rb:41
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config/environment.rb:5
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:3
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:1:in `new'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:1

这是我的 gem 文件

source 'http://rubygems.org'

gem 'rails', '3.0.9'

gem 'ar-extensions'
gem 'authlogic'
gem 'oauth'
gem 'twitter_oauth'
gem 'koala'
gem 'htmlentities'
# gem 'aws-s3', :require => 'aws/s3'
gem 'right_aws'
gem "typus", :git => "git://github.com/typus/typus.git", :branch => "3-0-stable"
gem 'flickraw'
gem 'delayed_job', '>= 2.0.4'
gem 'friendly_id', '3.1.7'
gem 'will_paginate', '~> 3.0'
gem 'rubyzip', :require => 'zip/zip'
gem 'nokogiri'
gem 'jammit'
gem 'mysql2', '< 0.3'
gem 'dalli'
gem 'closure-compiler'
gem 'yui-compressor', :require => 'yui/compressor'
gem 'geokit'
gem 'text'
gem 'fastercsv'
gem 'rapleaf_api'
gem 'hashie'
gem 'foursquare'
gem 'foursquare2'
gem 'oauth2'
gem 'google_places'
gem 'cancan'
gem 'juggernaut'
gem 'factory_girl'
gem 'whenever'
gem 'twitter'
gem 'sunspot', :require => 'sunspot'
gem 'sunspot_rails', :require => 'sunspot/rails'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'validatable'
gem 'redis'
gem 'redis-namespace'

# Use unicorn as the web server
gem 'unicorn'
gem 'capistrano'

group :development, :test do

end

这是我的插件列表:

acts_as_abusable  
acts_as_loggable
annotate_models
daemon_generator
masochism
mysql_bigint
perform_later
sitemap_generator
acts_as_likable
acts_as_solr
bitmask-attribute
gogo_cache
mobile-fu
oauth2_provider
resque

我现在已经在这个问题上苦苦挣扎了几个小时,我希望得到一个答案。

谢谢。

编辑:这是我完全删除typus后的堆栈跟踪:

/Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `include': wrong argument type Class (expected Module) (TypeError)
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `add_template_helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `module_eval'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:123:in `add_template_helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:98:in `helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:97:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/abstract_controller/helpers.rb:97:in `helper'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/actionpack-3.0.9/lib/action_controller/base.rb:228:in `inherited'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/app/controllers/application_controller.rb:1
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:491:in `load_missing_constant'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:183:in `const_missing'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in `const_missing'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/app/controllers/abuse_reports_controller.rb:1
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:138:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:137:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:137:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:135:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/engine.rb:135:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:108:in `eager_load!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application/finisher.rb:41
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config/environment.rb:5
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:3
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /Users/avitzurel/.rvm/gems/ruby-1.8.7-p334@gogo_web/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:1:in `new'
from /Users/avitzurel/Dropbox/Projects/gogobot_rails3/config.ru:1

最佳答案

`include': wrong argument type Class (expected Module) (TypeError)

也许你的一个助手被意外地重新定义为

# app/helpers/application_helper.rb
# make sure you never say "# class ApplicationHelper"
module ApplicationHelper

您可以使用此 grep 命令检查整个应用程序:

egrep -Ri "class.*Helper" *

如果您发现任何内容,请仔细检查它不应该是模块

关于ruby-on-rails - 从 Rails 2 升级到 Rails 3(以及 ruby​​ 版本)时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7083597/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com