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

Mailer with no implicit template #6801

Merged
merged 1 commit into from Jun 20, 2012
Merged

Mailer with no implicit template #6801

merged 1 commit into from Jun 20, 2012

Conversation

dmathieu
Copy link
Contributor

Currently, if we send an email and use the implicit template with it but not template exists, nothing fails.
I don't think that's the behavior usually intended.

This will raise an ActionView::MissingTemplate in that case.
It already occurs like this when rendering an explicit template.

@@ -733,6 +733,7 @@ def collect_responses_and_parts_order(headers) #:nodoc:

def each_template(paths, name, &block) #:nodoc:
templates = lookup_context.find_all(name, Array(paths))
raise ActionView::MissingTemplate.new([paths], name, [paths], false, 'mailer') if templates.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def each_template(paths, name, &block) #:nodoc:
  templates = lookup_context.find_all(name, Array(paths))

  if templates.empty?
    raise ActionView::MissingTemplate.new([paths], name, [paths], false, 'mailer')
  else  
    templates.uniq { |t| t.formats }.each(&block)
  end
end

Is not better to read?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right. I have updated it accordingly.

@rafaelfranca
Copy link
Member

Please add a CHANGELOG entry

@dmathieu
Copy link
Contributor Author

I have made the code change you suggested and added the changelog entry. Thanks @rafaelfranca

@ghost ghost assigned rafaelfranca Jun 20, 2012
rafaelfranca added a commit that referenced this pull request Jun 20, 2012
@rafaelfranca rafaelfranca merged commit c1c4ecb into rails:master Jun 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants