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'