DelayedJob:“Job failed to load:uninitialized constant Syck :: Syck” [英] DelayedJob: "Job failed to load: uninitialized constant Syck::Syck"
问题描述
`last_error` ='{作业无法加载:未初始化的常量Syck :: Syck 。处理程序:\---!ruby / struct:Delayed :: PerformableMailer ...
,我还有其他发送电子邮件的表单(例如:注册和登录用户),这些工作正如预期的那样,联系我们表单只出现问题。
我阅读了其他相关的问题帖子,但我仍然无法使此工作... 我如何解决问题?
PS:在升级到Rails 3.1之前,似乎是有效的。
更新 > @Shaun
现在我的'boot.rb'文件是
code> require'rubygems'
require'yaml'
YAML :: ENGINE.yamler ='syck'
#设置Gemfile中列出的宝石
gemfile = File.expand_path('../../ Gemfile',__FILE__)
begin
ENV ['BUNDLE_GEMFILE'] = gemfile
require'bundler'
Bundler .setup
rescue Bundler :: GemNotFound => e
STDERR.puts e。消息
STDERR.puts尝试运行`bundle install`。
exit!
如果File.exist?(gemfile)
需要 yaml
我收到这个错误(注意: Syck :: Syck :: BadAlias
是不同于以前的错误的新\ :
{无法加载作业:未初始化的常量Syck :: Syck :: BadAlias。处理程序:\---!ruby / struct:Delayed :: PerformableMailer ...
我的'database.yml'文件是:
开发:
适配器:mysql2
encoding:utf8
重新连接:false
数据库:app_name_development
池:5
用户名:root
密码:
套接字:/tmp/mysql.sock
test:
适配器:mysql2
编码:utf8
重新连接:false
数据库:app_name_test
池:5
用户名:root
密码:
套接字:/tmp/mysql.sock
生产:
适配器:mysql2
编码:utf8
重新连接:假
数据库:app_name_production
池:5
用户名:root
密码:*******
套接字:/var/run/mysqld/mysqld.sock
更新 for @KensoDev
我的'Gemfile'文件是:
'http://rubygems.org'
gem'rails','3.1.0'
gem'rake'
gem'mysql2'
gem'paperclip','〜> 2.3'
gem'will_paginate','〜> 3.0.pre2'
gem'delayed_job'
gem'memcache-client','1.8.5'
组:assets do
gem'sass-rails' ,'〜> 3.1.0'
gem'coffee-rails','〜> 3.1.0'
gem'uglifier'
end
gem'jquery-rails'
gem'capistrano'
gemrdoc,〜> 3.6.1
组:test do
#漂亮的打印测试输出
gem'turn',:require =>假
结束
其他信息
此时,为了调用交付方式,我使用以下代码:
:: Pages :: Mailer.delay.contact_us(@user)#它不工作,不发送电子邮件
另一方面,如果我使用以下代码:
#注意:在开始时没有'::'
Pages :: Mailer.delay.contact_us(@user)#它不起作用并引发'NameError' (如下所述)
我收到此错误:
NameError(未初始化的常量ActionController :: Caching :: Pages :: Mailer)
如果我使用不延迟版本,也会发生这种情况:
:: Pages :: Mailer。 contact_us(@user).deliver#它的作品和SENDS电子邮件!
页面:: Mailer.contact_us(@user).deliver#它不起作用并提高'NameError'
我写了一篇关于它的文章。
I am using Ruby on Rails 3.1 and the DelayedJob gem. I have a Contact Us form through which people can contact me. When I submit that I get the following error
`last_error` = '{Job failed to load: uninitialized constant Syck::Syck. Handler: \"--- !ruby/struct:Delayed::PerformableMailer ...
However, I have also others forms that send e-mails (eg: Sign Up and Sign In users) and those work as expected. The only problem seems to occur with the Contact Us form.
I read others related problem posts but I still cannot make that to work... how can I solve the problem?
P.S.: It seems that before upgrading to Rails 3.1 it worked.
UPDATE for @Shaun
Now my 'boot.rb' file is
require 'rubygems'
require 'yaml'
YAML::ENGINE.yamler= 'syck'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
After requiring yaml
I get this error (note: Syck::Syck::BadAlias
is "a new"\"different from the previous" error):
{Job failed to load: uninitialized constant Syck::Syck::BadAlias. Handler: \"--- !ruby/struct:Delayed::PerformableMailer ...
My 'database.yml' file is:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: app_name_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: app_name_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: app_name_production
pool: 5
username: root
password: *******
socket: /var/run/mysqld/mysqld.sock
UPDATE for @KensoDev
My 'Gemfile' file is:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'rake'
gem 'mysql2'
gem 'paperclip', '~> 2.3'
gem 'will_paginate', '~> 3.0.pre2'
gem 'delayed_job'
gem 'memcache-client', '1.8.5'
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
end
gem 'jquery-rails'
gem 'capistrano'
gem "rdoc", "~> 3.6.1"
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
ADDITIONAL INFORMATION
At this time, in order to call the delivering method, I use the following code:
::Pages::Mailer.delay.contact_us(@user) # It doesn't work and doesn't send the e-mail
On the other hand, if I use the following code:
# Note: It doesn't have the '::' at the beginning
Pages::Mailer.delay.contact_us(@user) # It doesn't work and raise the 'NameError' (described below)
I get this error:
NameError (uninitialized constant ActionController::Caching::Pages::Mailer)
The same happens if I use the "not delayed" version:
::Pages::Mailer.contact_us(@user).deliver # It works and SENDS THE E-MAIL!!!
Pages::Mailer.contact_us(@user).deliver # It doesn't work and raise the 'NameError'
I wrote a post about it.
http://www.kensodev.com/2011/08/16/uninitialized-constant-sycksyck-nameerror/
这篇关于DelayedJob:“Job failed to load:uninitialized constant Syck :: Syck”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!