如何使用haml模板解决此ActionMailer错误?

时间:2018-11-15 15:53:48

标签: ruby-on-rails ruby-on-rails-5 haml

我想对邮件使用HAML语法。我的React应用只是一个API,所以没有前端。

  • 导轨5.2.1
  • 红宝石2.5.1
  • haml(〜> 5.0.4)
  • haml-rails(〜> 1.0.0)

奇怪的是,当我将邮件程序的视图从* .html.erb重命名为* .html.haml时,尝试发送邮件时会收到此错误消息。

51: from -e:1:in `<main>'
50: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
49: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
48: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
47: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
46: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `block in load'
45: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
44: from /Users/steven/coding/mge/mge-finpowerment/bin/rails:11:in `<top (required)>'
43: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
42: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
41: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
40: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
39: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<top (required)>'
38: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/command.rb:46:in `invoke'
37: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/command/base.rb:65:in `perform'
36: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
35: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
34: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
33: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/console/console_command.rb:96:in `perform'
32: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/console/console_command.rb:19:in `start'
31: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/console/console_command.rb:64:in `start'
30: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:383:in `start'
29: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:427:in `run'
28: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:427:in `catch'
27: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:428:in `block in run'
26: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:487:in `eval_input'
25: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
24: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `catch'
23: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
22: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `loop'
21: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
20: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:488:in `block in eval_input'
19: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:623:in `signal_status'
18: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb.rb:491:in `block (2 levels) in eval_input'
17: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/context.rb:380:in `evaluate'
16: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/workspace.rb:85:in `evaluate'
15: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/workspace.rb:85:in `eval'
14: from (irb):2:in `irb_binding'
13: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionmailer-5.2.1/lib/action_mailer/message_delivery.rb:103:in `deliver_now!'
12: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionmailer-5.2.1/lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
11: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionmailer-5.2.1/lib/action_mailer/message_delivery.rb:104:in `block in deliver_now!'
10: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mail-2.7.0/lib/mail/message.rb:276:in `deliver!'
 9: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/letter_opener-1.6.0/lib/letter_opener/delivery_method.rb:24:in `deliver!'
 8: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy.rb:29:in `open'
 7: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/applications/browser.rb:79:in `open'
 6: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/application.rb:58:in `run'
 5: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:62:in `run'
 4: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:120:in `wet_run'
 3: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:120:in `fork'
 2: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:123:in 'block in wet_run'
 1: from /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:144:in 'exec_or_raise'
 /Users/steven/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/launchy-2.4.3/lib/launchy/detect/runner.rb:144:in `exec': No such file or directory - NONE (Errno::ENOENT)

有人暗示去哪里看吗?

1 个答案:

答案 0 :(得分:0)

例如,您需要在~/.bashrc中设置BROWSER环境变量(使用Google Chrome):

echo 'export BROWSER=google-chrome' >> ~/.bashrc

source ~/.bashrc

或者您可以使用(使用Firefox)运行服务器:

BROWSER=firefox rails server