English 中文(简体)
powerdns-on-rails ArgumentError
原标题:

My Environments:

CentOS 5
ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]
Ruby Enterprise Edition 20090610
passneger or webrick

I use this gem list.

*** LOCAL GEMS ***
actionmailer (2.3.2, 2.2.2)
actionpack (2.3.2, 2.2.2)
activerecord (2.3.2, 2.2.2)
activeresource (2.3.2, 2.2.2)
activesupport (2.3.2, 2.2.2)
fastthread (1.0.7)
haml (2.2.13)
mysql (2.7)
passenger (2.2.2)
rack (1.0.0)
rails (2.3.2, 2.2.2)
rake (0.8.7)
rmagick (2.9.2)
sqlite3-ruby (1.2.4)
will_paginate (2.2.2)

This is the error message. I don t know how can i solve it. Please help me.

When I use webrick:

Processing DashboardController#index (for 114.204.152.246 at 2009-11-14 10:52:57) [GET]

ArgumentError (Cannot yield from a Proc type filter. The Proc must take two arguments and execute #call on the second argument.):
  haml (2.2.5) [v] rails/./lib/sass/plugin/rails.rb:19:in `process 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/httpserver.rb:104:in `service 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/httpserver.rb:65:in `run 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:173:in `start_thread 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:162:in `start 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:162:in `start_thread 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:95:in `start 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:92:in `each 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:92:in `start 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:23:in `start 
  /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/1.8/webrick/server.rb:82:in `start 

Rendering /var/rails/powerdns-on-rails/public/500.html (500 Internal Server Error)

When I use passenger:

Processing DashboardController#index (for 114.204.152.246 at 2009-11-14 10:22:50) [GET]

ArgumentError (Cannot yield from a Proc type filter. The Proc must take two arguments and execute #call on the second argument.):
  haml (2.2.5) [v] rails/./lib/sass/plugin/rails.rb:19:in `process 
  passenger (2.2.2) lib/phusion_passenger/rack/request_handler.rb:81:in `process_request 
  passenger (2.2.2) lib/phusion_passenger/abstract_request_handler.rb:203:in `main_loop 
  passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler 
  passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application 
  passenger (2.2.2) lib/phusion_passenger/utils.rb:181:in `safe_fork 
  passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:296:in `handle_spawn_application 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `__send__ 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `main_loop 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:154:in `start 
  passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:192:in `start 
  passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:257:in `spawn_rails_application 
  passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add 
  passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:251:in `spawn_rails_application 
  passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize 
  passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize 
  passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:250:in `spawn_rails_application 
  passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application 
  passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:282:in `handle_spawn_application 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `__send__ 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `main_loop 
  passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously 

Rendering /var/rails/powerdns-on-rails/public/500.html (500 Internal Server Error)
问题回答

I had same problem, but my ruby are already 1.8.7. Ok, check out this article http://citizen428.net/archives/846, my solution was

after_save :callback

define_method :callback do
    # do something
end

changed to

after_save :callback

def callback do
    # do something
end

I was stuck on this as well and while I can t give you an explanation of the problem, I can tell you that upgrading to REE 1.8.7 fixed it for me. I m guessing it was some issue with ruby 1.8.6 that was exposed by the rails patch, but that s just a guess.

By the way, if you want to see the rails commit that introduced that "Can not yield from a Proc" error, go take a look at http://dev.rubyonrails.org/changeset/5163

Hope that helps.





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签