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
Custom templates #1
Comments
You should and can change the template root to point to your app/views: MailForm.template_root = Rails.root.join("app", "views") You can copy mail_form original template and add any you want. |
Thanks, Jose! That makes sense. Btw, I guess you wanted to say MailForm::Notifier.template_root = File.join(Rails.root, "app", "views") I've put that in config/initializers/mail_form.rb |
Yes! Rails.root.join("app", "views") The above should work also, since Rails.root returns a Pathname. |
While Rails.root.join("app", "views") correctly joins the parts, it doesn't work for specifying view paths, because of the way ActionView::PathSet works (it assumes that if it gets something that's not a string, then it's a view path object, but in this case it's Pathname). At least not in the rails version I'm using. |
A-ha! Maybe we would need to append .to_s, but good to know this gotcha. Thanks! |
Yep, Rails.root.join("app", "views").to_s would work perfectly |
I cannot locate this file: Kindly explain how to customize the template in latest releases (where there is no |
Hi guys,
The README says that it's possible to specify your own custom template for the notifier, but I'm not sure how exactly that can be done given that the notifier's template_root is set to lib/../views and it seems to be trying to load templates from there.
I guess it's possible to specify a relative path as a workaround if you have mail_form installed as a plugin, but in case of gem it won't work.
I wonder if I'm missing something and if you guys use this feature yourself.
Thanks!
The text was updated successfully, but these errors were encountered: