升级到Rails 4和Ruby 2之后的ArgumentError(错误的参数数量(1表示0))

时间:2013-12-30 16:41:15

标签: ruby-on-rails ruby oracle ruby-on-rails-4

我从Ruby 1.8.7和Rails 3.0.9升级到Ruby 2和Rails 4.0.2。

刷新网页localhost:3000时发生错误。我试图删除所有布局代码applicaton.html.erb和application.rb控制器代码,以排除Ruby或Rails版本的任何更改。在控制台中,我看不到除了回溯之外的任何东西

这次崩溃发生在使用Oracle的Linux中,Mac和Postgress本地数据库也没问题。

执行Select to Oracle的sys表时出错,尤其是获取SCHEMA_MIGRATIONS表的信息

我的Gemfile:

ruby '2.0.0'
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'activerecord-session_store'
gem 'net-ldap'
gem "composite_primary_keys", :require =>'composite_primary_keys'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer' #, '0.11.0beta5'
gem 'libv8', '~> 3.11.8'
gem 'execjs'
gem 'jquery-rails'
gem 'rails-observers'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end
group :oracle do
  gem 'ruby-oci8'
  gem 'activerecord-oracle_enhanced-adapter'
end
gem 'debugger', group: [:development, :test]

服务器控制台:

=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-12-30 16:53:26] INFO  WEBrick 1.3.1
[2013-12-30 16:53:26] INFO  ruby 2.0.0 (2013-11-22) [i686-linux]
[2013-12-30 16:53:26] INFO  WEBrick::HTTPServer#start: pid=22522 port=3000


Started GET "/" for nnn.nn.nn.nnn at 2013-12-30 16:53:55 +0100
  ActiveRecord::SchemaMigration Load (1.4ms)  SELECT "SCHEMA_MIGRATIONS".* FROM "SCHEMA_MIGRATIONS"
   (2.7ms)  SELECT column_name AS name, data_type AS sql_type, data_default, nullable, virtual_column, hidden_column, data_type_owner AS sql_type_owner, DECODE(data_type, 'NUMBER', data_precision, 'FLOAT', data_precision, 'VARCHAR2', DECODE(char_used, 'C', char_length, data_length), 'RAW', DECODE(char_used, 'C', char_length, data_length), 'CHAR', DECODE(char_used, 'C', char_length, data_length), NULL) AS limit, DECODE(data_type, 'NUMBER', data_scale, NULL) AS scale FROM all_tab_cols WHERE owner = '-----' AND table_name = 'SCHEMA_MIGRATIONS' AND hidden_column = 'NO' ORDER BY column_id
  Primary Key (34.2ms)  SELECT cc.column_name FROM all_constraints c, all_cons_columns cc WHERE c.owner = '-----' AND c.table_name = 'SCHEMA_MIGRATIONS' AND c.constraint_type = 'P' AND cc.owner = c.owner AND cc.constraint_name = c.constraint_name

ArgumentError (wrong number of arguments (1 for 0)):
  actionpack (4.0.2) lib/abstract_controller/base.rb:89:in `initialize'
  actionpack (4.0.2) lib/abstract_controller/base.rb:89:in `new'
  actionpack (4.0.2) lib/abstract_controller/base.rb:89:in `action_methods'
  actionpack (4.0.2) lib/action_controller/metal/hide_actions.rb:36:in `action_methods'
  actionpack (4.0.2) lib/abstract_controller/url_for.rb:25:in `action_methods'
  actionpack (4.0.2) lib/abstract_controller/base.rb:179:in `action_method?'
  actionpack (4.0.2) lib/abstract_controller/base.rb:230:in `method_for_action'
  actionpack (4.0.2) lib/action_controller/metal/hide_actions.rb:17:in `method_for_action'
  actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:14:in `method_for_action'
  actionpack (4.0.2) lib/abstract_controller/base.rb:130:in `process'
  actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process'
  actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
  actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action'
  actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call'
  actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
  actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call'
  actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'.......

1 个答案:

答案 0 :(得分:0)

解决。

我不知道到底发生了什么,但是解决方案是回到旧版本的RoR,感谢git branch和rvm,然后再次执行Bundle update和Bundle install。