使用Mailer和在生产中预编译的资产

时间:2012-06-17 02:12:58

标签: ruby-on-rails mailer precompile

我在生产环境中从命令提示符处使用Mailer时遇到问题。使用此命令

Mailer.function.deliver

给出此错误

Errno::ENOTDIR: Not a directory - /assets/
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `initialize'
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:70:in `request_and_unzip'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:45:in `load_css_at_path'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:15:in `css_for_doc'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/premailer.rb:14:in `initialize'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/hook.rb:18:in `new'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/hook.rb:18:in `delivering_email'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:230:in `block in inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:229:in `each'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:229:in `inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/message.rb:218:in `inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/message.rb:228:in `deliver'
from (irb):1
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3-p194 :002 >

如果我删除'public / assets'文件夹,我可以解决问题,但这会导致生产网站的其余部分在加载images / css等时失败。

我使用此命令rake assets:precompile

预编译我的资源

1 个答案:

答案 0 :(得分:0)

想出来。似乎在生产中用于rails 3.1预编译资产管道,预编译器要求在预编译资产之前,email.css下至少有一个空白app/assets/stylesheets