parolkar 的 pfeed 插件 - 保存 feed 时出现问题

发布于 2024-11-19 14:55:18 字数 1845 浏览 1 评论 0原文

我已经使用 parolker 的 pfeed 插件来记录用户活动,但在保存提要时遇到错误。下面是显示的错误消息。

TypeError (wrong argument type nil (expected Data)):
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck.rb:401:in `emit'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck.rb:401:in `quick_emit'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck/rubytypes.rb:40:in `to_yaml'
  vendor/plugins/pfeed/app/models/pfeed_item.rb:37:in `log'
  (eval):7:in `start_followup_with_pfeed'
  app/controllers/individuals_controller.rb:329:in `add_followup'
  /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/rack.rb:27:in `call'
  /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/user_informer.rb:12:in `call'
  :10:in `synchronize'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

错误消息指向 pfeed_item.rb 的第 37 行,即 p_item.save! 我尝试了 p_item .errors 但它返回空消息。

你们有什么想法吗?

提前致谢:)

PS: Rails 2.3.5Ruby 1.9.2-p180

=========

Model: individual.rb

def start_followup(ind_followup)
  puts "added follow-up"
end

def complete_followup(ind_followup)
  puts "completed follow-up"
end

emits_pfeeds :on => [:start_followup,:complete_followup] , :for => [:itself]   # Note: if feed needs to be received by all users , you could use :for => [:all_in_its_class]
receives_pfeed

从控制器调用模型方法作为

@individual.start_followup(@followup)

Beside这一切都是在 pfeed 中完成的。

I have used parolker's pfeed plugin to log users activities but I am getting error while saving the feed. Below is the error message displayed.

TypeError (wrong argument type nil (expected Data)):
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck.rb:401:in `emit'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck.rb:401:in `quick_emit'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck/rubytypes.rb:40:in `to_yaml'
  vendor/plugins/pfeed/app/models/pfeed_item.rb:37:in `log'
  (eval):7:in `start_followup_with_pfeed'
  app/controllers/individuals_controller.rb:329:in `add_followup'
  /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/rack.rb:27:in `call'
  /Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/hoptoad_notifier-2.4.9/lib/hoptoad_notifier/user_informer.rb:12:in `call'
  :10:in `synchronize'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

The error message points line 37 of pfeed_item.rb which is p_item.save! I tried p_item.errors but it returns empty message.

Do you guys have any idea?

Thanks in advance :)

PS: Rails 2.3.5 and Ruby 1.9.2-p180

=========

Model: individual.rb

def start_followup(ind_followup)
  puts "added follow-up"
end

def complete_followup(ind_followup)
  puts "completed follow-up"
end

emits_pfeeds :on => [:start_followup,:complete_followup] , :for => [:itself]   # Note: if feed needs to be received by all users , you could use :for => [:all_in_its_class]
receives_pfeed

The model method is called from controller as

@individual.start_followup(@followup)

Beside this everything is done in pfeeds.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文