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

padrino-mailer's 'render' does not render relative to the mailer-specific directory in app/views/mailers/ #1906

Closed
jf opened this Issue Apr 7, 2015 · 0 comments

Comments

Projects
None yet
3 participants
@jf

jf commented Apr 7, 2015

Not too sure why this isn't marked as an issue, but I would expect, given that padrino-gen mailer creates the mailer-specific directory in app/views/mailers/, that the default directory for 'render' would be that mailer-specific directory.

The documentation (http://www.padrinorb.com/guides/padrino-mailer), under Mailer Usage (yes, I'm aware there are other typos, but) says this:

# app/mailers/sample_mailer.rb
MyAppName.mailer :sample do
  email :registration_email do |name, email|
    from 'admin@site.com'
    to email
    subject 'Welcome to the site!'
    locals :name => name, :email => email
    render 'registration_email'
    content_type :html       # optional, defaults to :plain
    via :sendmail            # optional, to smtp if defined otherwise sendmail
  end
end

...

This mailer defines a mail type called ‘registration_mail’ with the specified attributes
for delivery. The body method is invoking the render command passing the name
attribute to the body message template which should be defined in
[views_path]/mailers/sample/registration_email.erb as shown below:

As it turns out, though (both from experience; and verified by looking through the source of padrino-mailer 0.12.5), this is not the case. Every render is relative to app/views/mailers, never mind what mailer.

Now back to the documentation. Under Multipart Emails, it says this, which would seem to indicate app/views/mailers instead (although even here, I would argue that it leaves some space for vagueness. So is it app/views/mailers/sample/path/to/basic*? app/views/mailers/path/to/basic*?):

# app/mailers/sample_mailer.rb
mailer :sample do
  email :email_with_parts do
    from 'admin@site.com'
    # ...
    # renders path/to/basic.html.erb and path/to/basic.plain.erb
    provides :plain, :html
    render 'path/to/basic'
  end
end

Are there any plans to shift to using app/views/mailers/<mailer-name>?

@nesquena nesquena modified the milestone: 0.13.1 Oct 12, 2015

@ujifgc ujifgc modified the milestone: 0.13.1 Dec 12, 2015

@ujifgc ujifgc added the bug label Jan 15, 2016

@ujifgc ujifgc closed this in cc6fe63 Jun 5, 2016

ujifgc added a commit that referenced this issue Sep 4, 2016

ujifgc added a commit that referenced this issue Sep 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment