I also run into the same error when running Spec tests that trigger Observers, which trigger DelayedJobs.
The full stack trace: ruby-1.8.7-p249/lib/ruby/1.8/yaml.rb:391:in `emit' ruby-1.8.7-p249/lib/ruby/1.8/yaml.rb:391:in `quick_emit' ruby-1.8.7-p249/lib/ruby/1.8/yaml/rubytypes.rb:15:in `to_yaml' vendor/bundler_gems/gems/delayed_job-2.0.3/lib/delayed/backend/base.rb:61:in `payload_object=' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2746:in `send' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2746:in `attributes=' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2742:in `each' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2742:in `attributes=' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2438:in `initialize' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:721:in `new' vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:721:in `create' vendor/bundler_gems/gems/delayed_job-2.0.3/lib/delayed/backend/base.rb:21:in `enqueue' app/models/mail_opt_in_observer.rb:12:in `after_save' app/models/mail_opt_in_observer.rb:11:in `each' app/models/mail_opt_in_observer.rb:11:in `after_save' vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb:32:in `send' vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb:32:in `update' I've been trying to find the root of this for a few days now and its getting a little frustrating. I've tried to re-open the class and do the following (because I noticed the error doesn't occur when I *clone* the object and then call to_yaml). module ActiveRecord class Base to_old_yaml = self.instance_method(:to_yaml) define_method(:to_yaml) do clone = self.clone clone.id = self.id oh_boy = to_old_yaml.bind(clone).call #debugger #testtest = 'test' return oh_boy end end end ...but this yields a similar error: wrong argument type String (expected Data) > Scott wrote: > I have a query I am running from the console that is eager loading the > address on the people model: > > people = People.find(:all, > :include => [:address], > :limit => 50) > > Trying to output that to yaml via: > > people.to_yaml > > Produces the following exception: > > TypeError: wrong argument type nil (expected Data) > from /usr/local/lib/ruby/1.8/yaml.rb:387:in `emit' > from /usr/local/lib/ruby/1.8/yaml.rb:387:in `quick_emit' > from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:107:in `to_yaml' > from (irb):10 > > I don't see any nil data in the include... thoughts? > > Thanks, > > Scott -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.