Ruby on rails 3 ImagesController索引中存在ArgumentError,但应用程序跟踪为空

Ruby on rails 3 ImagesController索引中存在ArgumentError,但应用程序跟踪为空,ruby-on-rails-3,frameworks,controller,Ruby On Rails 3,Frameworks,Controller,我正在为一个类调用索引操作,该类会出现以下错误: 在2011年8月28日星期日06:14:41+0200开始获取127.0.0.1版本的“/images” ImagesController#索引为HTML的处理已完成500次 1ms内发生服务器错误 ArgumentError(参数数目错误(2代表0)): 应用程序跟踪中没有任何内容,这意味着故障发生在我为应用程序创建的任何文件得到处理之前。完整跟踪如下: activesupport (3.0.8) lib/active_support/call

我正在为一个类调用索引操作,该类会出现以下错误:

在2011年8月28日星期日06:14:41+0200开始获取127.0.0.1版本的“/images” ImagesController#索引为HTML的处理已完成500次 1ms内发生服务器错误

ArgumentError(参数数目错误(2代表0)):

应用程序跟踪中没有任何内容,这意味着故障发生在我为应用程序创建的任何文件得到处理之前。完整跟踪如下:

activesupport (3.0.8) lib/active_support/callbacks.rb:97:in `send'
activesupport (3.0.8) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (3.0.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.8) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.8) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.8) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.8) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.8) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.8) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.8) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.8) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.8) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.8) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.8) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.8) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:82:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.8) lib/action_dispatch/routing/route_set.rb:493:in `call'
sass (3.1.7) lib/sass/./sass/plugin/rack.rb:54:in `call'
warden (1.0.5) lib/warden/manager.rb:35:in `call'
warden (1.0.5) lib/warden/manager.rb:34:in `catch'
warden (1.0.5) lib/warden/manager.rb:34:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.8) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.8) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.8) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.8) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.8) lib/active_support/callbacks.rb:419:in `_run_call_callbacks'
actionpack (3.0.8) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.8) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.8) lib/rails/application.rb:168:in `call'
railties (3.0.8) lib/rails/application.rb:77:in `send'
railties (3.0.8) lib/rails/application.rb:77:in `method_missing'
railties (3.0.8) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/jon/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.3) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.8) lib/rails/commands/server.rb:65:in `start'
railties (3.0.8) lib/rails/commands.rb:30
railties (3.0.8) lib/rails/commands.rb:27:in `tap'
railties (3.0.8) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
下面是lib/active\u support/callbacks.rb中的相关代码,我对其进行了修改以打印出方法参数

def run_callbacks(kind, *args, &block)
  p *args
  p &block
  p kind
  send("_run_#{kind}_callbacks", *args, &block)
end
以下是带有上述代码的输出:

"callback arguments"
:checkout 
"callback arguments"
"index"
:process_action

Started GET "/images" for 127.0.0.1 at Sun Aug 28 06:40:37 +0200 2011 
Processing by ImagesController#index as HTML Completed 500 Internal
Server Error in 1ms

ArgumentError (wrong number of arguments (2 for 0)):


Rendered
/home/jon/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.5ms) Rendered
/home/jon/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(8.6ms) Rendered
/home/jon/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (20.9ms)
以下是DB模式:

create_table "images", :force => true do |t|
  t.string   "photo"
  t.integer  "w"
  t.integer  "h"
  t.integer  "eyes"
  t.integer  "head_top"
  t.integer  "head_bottom"
  t.integer  "user_id"
  t.string   "face_params",  :limit => 2000
  t.string   "smiling"
  t.string   "facing"
  t.string   "filename"
  t.string   "content_type"
  t.binary   "data",         :limit => 16777215
  t.datetime "created_at"
  t.datetime "updated_at"
end
以下是相关控制器代码:

def index
  p "made it to index action--------------------------"
  if user_signed_in?
    @user = current_user
    @selected_image = @user.get_selected_image
    @problems = @selected_image ? @selected_image.problems.all : Array.new
    @images = @user.images - Array[@selected_image]
    @image = @user.image_build

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @images }
    end
  else
    redirect_to root_path
  end
end
所有其他控制器似乎都在工作。此控制器的其他操作也会出现相同的错误

有什么想法吗

编辑:根据下面的评论添加Routes.rb

Id::Application.routes.draw do
  resources :payment_notifications
  resources :addresses

  resources :orders do
    member do
      get "select_address_for"
      put "set_address_for"
      get "complete"
    end
  end

  resources :prints do
    member do
      post "email"
      get "confirm_email"
    end
  end

  resources :images do
    member do
      put "select"
      get "thumb"
      get "send"
    end
  end

  resources :docs do
    member do
      get "image_for"
    end
  end

  devise_for :users

  ##This will redirect the user after sign-in or sign-up. 
  ##Otherwise is will default to the 'root' route, defined below
  #devise_for :users do
  #  get 'users', :to => 'docs#index', :as => :user_root # Rails 3
  #end

  resources :admins
  resources :assistants
  resources :books
  resources :links
  resources :categories
  resources :tips
  resources :rules
  resources :countries
  resources :types
  resources :continents

  # match ':controller(/:action(/:id(.:format)))'
  # match ':controller/:action/:id'
  # match ':controller/:action/:id.:format'
  # match ':controller/:action.:format'
end

您正在重新定义
images
控制器中的
send
方法,这是一种基本的ruby方法。将其重命名为其他名称,您的问题就会消失。

此控制器中是否有任何筛选器?控制器或应用程序控制器中未列出任何筛选器。我确实在应用程序控制器中启用了“防止伪造”功能,我只是在尝试/图像显示“无路由匹配”错误/images/new或任何其他有效url会给出上述错误。所有其他控制器似乎都正常工作。我在主帖子中添加了routes.rb。您正在重新定义send方法,这是一个基本的ruby方法。你能给它改名吗?