Rails 5.2에서 구성이 유효합니까?
13973 단어 letter_opener
묘사
초기값 설정 항목에서 다음 코드를 사용하려고 합니다.LetterOpener.configure do |config|
# To overrider the location for message storage.
# Default value is <tt>tmp/letter_opener</tt>
config.location = Rails.root.join('tmp', 'my_mails')
# To render only the message body, without any metadata or extra containers or styling.
# Default value is <tt>:default</tt> that renders styled message with showing useful metadata.
config.message_template = :light
end
하지만 내게 잘못이 하나 있다./Users/patrick/Sites/ziegfeld/config/initializers/email.rb:14:in `<main>': undefined method `configuration' for LetterOpener:Module (NoMethodError)
5.2 문제인가요?아니면 내가 뭘 잘못했나?토론 #1
@mokolabs 당신의 모든 것을 보여줄 수 있습니까initializers/email.rb
?토론 #2
@nashby는 내가 위에 붙인 코드 블록 (자술한 파일에서 복사한 것) 과 같습니다.나는 단지 내 메일에 같은 코드를 넣었을 뿐이다.rb 초기화 파일.다른 문법을 사용해야 합니까?
토론 #셋
@mokolabs는 이상하게도 Stacktrace가 이메일에서 14번째 줄을 언급했다.rb 그러나 자술과 같으면 14줄이 없어야 한다.토론 #4
@nashby 죄송합니다.잘 받았어.내
email.rb
초기값 설정에는 프로덕션 STMP 설정을 구성하는 데 사용되는 다음과 같은 블록이 있습니다.# Send emails
if Rails.env.production? or ENV['SEND_EMAIL_VIA_SMTP'] == 'true'
ActionMailer::Base.smtp_settings = {
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
end
그러나 이 코드는 개봉기 오류와는 전혀 무관하다.위의 SMTP 코드를 잠시 삭제했습니다. 이로써 제 email.rb
초기 값 설정 항목은 현재 개봉기의 설정 코드만 포함됩니다.LetterOpener.configure do |config|
# To overrider the location for message storage.
# Default value is <tt>tmp/letter_opener</tt>
config.location = Rails.root.join('tmp', 'my_mails')
# To render only the message body, without any metadata or extra containers or styling.
# Default value is <tt>:default</tt> that renders styled message with showing useful metadata.
config.message_template = :light
end
나는 여전히 같은 실수를 범할 것이다.다음은 스택 추적입니다.09:34:36 web.1 | => Booting Thin
09:34:36 web.1 | => Rails 5.2.0.beta2 application starting in development on http://localhost:3000
09:34:36 web.1 | => Run `rails server -h` for more startup options
09:34:38 web.1 | /Users/patrick/Sites/ziegfeld/config/initializers/email.rb:1:in `<main>': undefined method `configure' for LetterOpener:Module (NoMethodError)
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `block in load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:657:in `block in load_config_initializer'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications.rb:170:in `instrument'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:656:in `load_config_initializer'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `block in <class:Engine>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `instance_exec'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:61:in `block in run_initializers'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `tsort_each_child'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:60:in `run_initializers'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/application.rb:360:in `initialize!'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/config/environment.rb:5:in `<main>'
09:34:38 web.1 | from config.ru:3:in `require_relative'
09:34:38 web.1 | from config.ru:3:in `block in <main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
09:34:38 web.1 | from config.ru:in `new'
09:34:38 web.1 | from config.ru:in `<main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:27:in `app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:51:in `start'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:147:in `block in perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:142:in `tap'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:142:in `perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/command/base.rb:65:in `perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/command.rb:46:in `invoke'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands.rb:18:in `<main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `block in require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `require'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/rails:9:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/spring:15:in `require'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/spring:15:in `<top (required)>'
09:34:38 web.1 | from bin/rails:3:in `load'
09:34:38 web.1 | from bin/rails:3:in `<main>'
09:34:38 web.1 | Exiting
09:34:38 web.1 | exited with code 1
09:34:38 system | sending SIGTERM to all processes
09:34:38 log.1 | terminated by SIGTERM
09:34:38 worker.1 | terminated by SIGTERM
이게 지금 더 의미가 있었으면 좋겠어요!토론 #5
이곳의 배치도 같은 문제가 있다.토론 #6
@DaveTorbeck@mokolabs 죄송합니다. 설정 기능이 아직 발표되지 않았습니다.너는 스승님을 시험해 볼 수 있니, 괜찮은지 좀 볼 수 있니?가능하다면, 나는 새로운 버전을 발표할 것이다.감사합니다!토론 #7
맞아요. 제가 직접 테스트를 해서 1.5.0판을 발표했어요.이 문제를 알려줘서 고마워요!토론 #8
달콤하다.감사합니다!Reference
이 문제에 관하여(Rails 5.2에서 구성이 유효합니까?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://github.com/ryanb/letter_opener/issues/146텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)