- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我有一个网络应用需要做一些后台工作。我有一个 clock.rb
文件,其中包含:
require 'clockwork'
include Clockwork
require './config/boot'
require './config/environment'
every(5.seconds, 'ticking.get') { Resque.enqueue(TickingJob) }
[...rest of the code irrelevant...]
当我尝试使用 clockwork app/clock.rb
启动文件时,出现以下错误:
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/configurable.rb:31:in `config': undefined method `inheritable_copy' for #<Hash:0x000000012b3f08> (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/configurable.rb:86:in `config'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/configurable.rb:59:in `default_per_page='
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari/config.rb:35:in `block in <module:Kaminari>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari/config.rb:9:in `configure'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari/config.rb:34:in `<module:Kaminari>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari/config.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari.rb:38:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari.rb:38:in `load_kaminari!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari.rb:47:in `hook!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari.rb:60:in `load!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/lib/kaminari.rb:73:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /home/raph/public/[...]/config/application.rb:7:in `<top (required)>'
from /home/raph/public/[...]/config/environment.rb:2:in `require'
from /home/raph/public/[...]/config/environment.rb:2:in `<top (required)>'
from /home/raph/public/[...]/app/clock.rb:5:in `require'
from /home/raph/public/[...]/app/clock.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/clockwork-0.4.0/bin/clockwork:12:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/clockwork-0.4.0/bin/clockwork:12:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/clockwork:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/clockwork:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
关于“psych”的第一个错误似乎并不相关(我每次都遇到它,而且我确实重新安装了 libyaml
)。至于第二个,我没有头绪。 activesupport
模块的代码是否有问题?
最佳答案
您需要将 include Clockwork
行移至 require
行下方:
require 'clockwork'
require './config/boot'
require './config/environment'
include Clockwork
every(5.seconds, 'ticking.get') { Resque.enqueue(TickingJob) }
[...rest of the code irrelevant...]
关于ruby-on-rails - 无法使用 Clockwork 启动 clock.rb 模块 - 来自 activesupport 的未定义方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12747267/
我试图记住 Javascript 中称为“发条算术”的东西,我很久以前在有关幻灯片/轮播的教程中读过它。 (术语可能有误,因为我在谷歌中找不到任何有用的东西) 它是以下代码的简写: a = a + 1
我正在使用 Clockwork 进行 laravel 设置安装。而且我有一个 artisan 命令需要很长时间才能运行,所以发条会消耗太多内存。我仍然需要那个延期。如何在仅运行命令时禁用它? 最佳答案
我想了解如何使用发条执行自定义代码。这是 Heroku 在其开发中心文档中使用的示例 lib/clock.rb 文件。 require File.expand_path('../../config/b
我遇到了 Clockwork 调度程序进程的语法问题。我实际上遇到了与此线程中讨论的问题类似的问题,但从未得到完整回答(How do I use Rails clockwork gem to run
从 Clockwork 调用 rake 任务的语法是什么?我尝试了各种语法,但似乎没有任何效果。 (我对发条装置特别感兴趣,因为 Heroku 支持它。) 这是我的clock.rb,使用与每当gem使
我正在读取一些传感器值,我想安排重复作业以便每隔 :00、:10、:15、:20、:25、:30、:35 等重复一次。 我在 Rails 5 中使用 clockwork/delayed_job/act
我有一个网络应用需要做一些后台工作。我有一个 clock.rb 文件,其中包含: require 'clockwork' include Clockwork require './config/boo
我是一名优秀的程序员,十分优秀!