ruby-on-rails - 未定义的方法 `name' 为 "actionmailer":String

标签 ruby-on-rails ruby rubygems actionmailer browsercms

我有一个旧版本的 Rails 项目,它是使用 BrowserCMS 构建的 在配置/环境文件中

RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

所以我使用 rvm 安装了这个 gems,所以我可以运行它

$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.8, 2.3.4)
actionpack (2.3.8, 2.3.4)
activerecord (2.3.8, 2.3.4)
activeresource (2.3.8, 2.3.4)
activesupport (2.3.8, 2.3.4)
bundler (1.1.4)
mysql (2.8.1)
rack (1.1.3, 1.0.1)
rails (2.3.4)
rake (0.8.7)

我运行 rake db:create 它工作正常,但是当我运行 rake db:migrate 时出现这个错误

rake aborted!
undefined method `name' for "actionmailer":String

我尝试使用 Trace,但没有得到任何帮助

$ rake db:migrate --trace
(in /home/azzurrio/Desktop/berkmancenter-fair_use_tool-f8f65ea)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "actionmailer":String
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/rails/gem_dependency.rb:268:in `=='
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `==='
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/specification.rb:411:in `each'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410:in `each'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:132:in `process'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
/home/azzurrio/Desktop/berkmancenter-fair_use_tool-f8f65ea/config/environment.rb:9
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/tasks/misc.rake:4
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/bin/rake:31
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/bin/rake:19:in `load'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/bin/rake:19

有什么帮助吗?

最佳答案

我遇到了这个问题。 解决方案是将 ruby​​gems 降级到您支持的版本。

我需要版本 1.3.5(用于 rails 2.3.5)

所以你需要做:

gem install rubygems-update -v 1.3.5

update_rubygems --version=1.3.5

现在 rake 应该可以工作了。

关于ruby-on-rails - 未定义的方法 `name' 为 "actionmailer":String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11028804/

相关文章:

ruby-on-rails - 如何将变量传递到此部分以用作计数器?

ruby - 获取 Rails 项目中包含的所有 gem 的变更日志

ruby-on-rails - Ruby stdlib 和 Rails stdlib 中的日期类不同

ruby-on-rails - Rails 4,重定向到 "pages/congrats"

ruby-on-rails - 如何从 rails_admin/ckeditor 中删除 html 标签,以便字段内容不包含 html 标签?

mysql - 在 Ruby 中使用 Mysql gem 运行脚本(多个语句)

Ruby:如何显示来自 Google Analytics 的图表?

ruby - bundle 安装莫名其妙地挂起

ruby-on-rails - rails 3 : Mass-assignment with ActiveAdmin and has_one

ruby-on-rails - Capistrano 指向不再存在的旧版本