2012-04-13 7 views

答えて

6

rails generate devise:viewsおよび編集テンプレートを実行します。これを行うには、デフォルトの工夫を上書きするリンクの指示に従ってください

::メーラー: https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer

その後、attachments.inline['logo.png']=を使用して添付ファイルを追加します。

def reset_password_instructions(record, opts={}) 
    attachments.inline['logo.png'] = File.read('app/assets/images/logo.png') 
    super(record, opts) 
end 

そして、あなたができるビューで使用するattachments['logo.png'].url

<%= image_tag(attachments['logo.png'].url, alt: 'Logo') %> 
2

ちょうどあなたが添付ファイルとしてロゴ画像を追加する必要がapp/views/devise/mailer/reset_password_instructions.html.erb

+0

ただし、このような方法で画像を追加することはできません。私はそれをしようとしているときだけ、悪いリンクを受け取る。メッセージに添付ファイルを追加する必要があります - どうすればいいですか? –

0

私はrails 5 appにdevise 4.3を使用しています。追加の議論が必要です。

def reset_password_instructions(record, token, opts={}) 
    attachments.inline['logo.png'] = File.read("#{Rails.root}/app/assets/images/logo.png") 
    super(record, token, opts) 
end 
関連する問題