我使用Ruby on Rails的3.1和DelayedJob宝石。我有一个联系我们表单,人们可以通过它与我联系。当我认为我得到以下错误DelayedJob: “作业未能负荷:未初始化不断SYCK :: SYCK”
`last_error` = '{Job failed to load: uninitialized constant Syck::Syck. Handler: \"--- !ruby/struct:Delayed::PerformableMailer ...
不过,我也有其他形式的发送电子邮件(如:注册和登录用户)以及那些工作预期。唯一的问题似乎与联系我们表单发生。
我看了其他相关的问题帖子,但我仍然无法让它工作... 我该如何解决这个问题?
P.S .:看起来,升级到Rails 3.1之前它工作。
UPDATE为@Shaun现在
我 '的boot.rb' 文件
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)
需要yaml
后,我得到这个错误(注:Syck::Syck::BadAlias
是“新“\” 从以前的”错误不同):
{Job failed to load: uninitialized constant Syck::Syck::BadAlias. Handler: \"--- !ruby/struct:Delayed::PerformableMailer ...
我 '的database.yml' 文件是:
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为@KensoDev
我 '的Gemfile' 文件是:
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
附加信息
此时,为了调用传送方法,我用下面的代码:
::Pages::Mailer.delay.contact_us(@user) # It doesn't work and doesn't send the e-mail
在另一方面,如果我使用下面的代码:
# 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)
我得到这个错误:
NameError (uninitialized constant ActionController::Caching::Pages::Mailer)
同样的情况,如果我使用了“不推迟”版本:
::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'
我有一些问题,运行命令'gem update --system':http://stackoverflow.com/questions/7496519/trouble-on-re-installing-ruby-from-scratch ...我该怎么办? (!) – user12882
尽管我以前(负面)的经验,我试图运行'gem update --system'命令,我得到以下消息:'当前安装的最新版本。 Aborting.'。 – user12882
您使用的是RVM吗? – KensoDev