Skip to content
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

How to query templates table within mailer ? #73

Open
dekhaus opened this issue May 30, 2024 · 1 comment
Open

How to query templates table within mailer ? #73

dekhaus opened this issue May 30, 2024 · 1 comment

Comments

@dekhaus
Copy link

dekhaus commented May 30, 2024

Hi

If I have multiple templates stored in my database - how can I perform a query in my mailer so that my mailer retrieves the template I want to use and uses that to generate the mail message ?

The documentation contains the following snippet ...

class MyEmail < ActionMailer::Base
  prepend_view_path TemplateStorage.resolver

but that doesn't give me the control that I need to retrieve the template my mailer needs to use based on supplied criteria

how can I modify the call above ( prepend_view_path TemplateStorage.resolver ) so that arguments are passed to the 'resolver' which can be used to query my templates table and only retrieve the needed template ?

Thanks
Dave

@andreapavoni
Copy link
Owner

I'm not sure what you're asking for, however several ways to select the template to render, even passing a specific path.

You could also create a new subclass that inherits from the parent template storage and add specific behaviours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants