New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActionMailer::Preview uses different execution of mailer for email info bar and email content #24460
Comments
The email content is displayed in an iframe and fetched in a separate request(based on whether html or text is selected in dropdown). cc @pixeltrix if we are interested to update this header info as well. It would need a full-page reload/or not using this iframe though. |
Yeah, we'd need to redesign the page so that the whole page would be re-rendered at the same time. @barnett your example is very contrived - do you have a real-world example where this has affected you? |
@pixeltrix sure! In a PreviewMailer I am using code sample: class AccountMailerPreview < ActionMailer::Preview
def upcoming_surveys
accounts = Account.active.with_upcoming_surveys
AccountMailer.upcoming_surveys(accounts.sample.id)
end
end While I could hypothetically use |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
Reproduced on Rails 7.0.4 |
Steps to reproduce
Create a mailer:
Create a preview:
And in
apps/views/object_mailer/event_happened.html.erb
:The object will differ.
Example Repo
/rails/mailers/object_mailer/event_updated
Expected behavior
I would expect the render for the email and email info bar use the same execution. Thus the
Object#id
in thesubject
and within the email would be the same.Actual behavior
They render with different instances.
System configuration
Rails version:
5.0.0.beta1
Ruby version:
2.3.0
The text was updated successfully, but these errors were encountered: