I have my mailer on rails 3.1 which has an inline attachment.
To open that attachment i use this code:
attachments["rails.png"] = File.read("#{Rails.root}/app/assets/images/Rails.png")
is there a way to change that with something like assets_url
?
File.read(Rails.root.join('app/assets/images', 'Rails.png'))
from which you can make your own "asset_url"-like helper. – MoreyFile.read(Rails.root.join('public', view_context.asset_path('Rails.png')))
? It should work as compiled assets are always in public/assets. Thatview_context
may not be necessary (or it may not be available in ActionMailer :( ) but let's give it a try! – Morey