Skip to content

Using Components with Multipart Emails (multiple formats) #1670

@jaredmoody

Description

@jaredmoody

I was trying to convert a partial that's used in my mailers to a ViewComponent today, and because the partial is used in a multipart email, it has a plaintext template (_thing.text.erb) as well as an html template (_thing.html.erb). I was surprised I could not define a component with two different template formats, I get the following error:

ViewComponent::TemplateError: More than one template found for Mailers::ThingComponent. There can only be one default template file per component.

Maybe I could workaround by using a variant?

It sure would be nice if this just worked out of the box the way that Rails does with different formats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions