2025/1/9 に確認した状態です。本家更新にはお気をつけて。
29cef61 8 months ago
>29cef61さんが2024/5に更新した記事。
緑色の文字は手入力した場所です。 (勿論記載してない場合もあります。)
⭐️下記から本家記事翻訳
インストール方法 まずgemを開発環境に追加し、bundleコマンドを実行してインストールする。
group :development do
gem 'letter_opener_web', '~> 3.0'
end
使用方法 routes.rbに追加します:
Your::Application.routes.draw do
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
end
そして、あなたのアプリに:letter_opener配信メソッドが設定されていることを確認してください。そして、メール送信後に http://localhost:3000/letter_opener にアクセスして楽しんでください。
VagrantマシンやDockerコンテナからアプリを実行している場合は、letter_openerのlaunchyコールをスキップして、これらのようなメッセージを回避したいかもしれません:
12:33:42 web.1 | Failure in opening /vagrant/tmp/letter_opener/1358825621_ba83a22/rich.html
with options {}: Unable to find a browser command. If this is unexpected, Please rerun with
environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at
<https://github.com/copiousfreetime/launchy/issues/new>