sighmon/mjml-rails

Can i override a layout?

Opened this issue · 1 comments

Hello, i think this might be something basic that i am not understanding.

I got a mailer like this:

class OrderMailer < ApplicationMailer
  layout 'mjml_layout'
  
  def created
    # some logic here
    mail(to: emails, subject: '')
  end
  
  ...
  # like the created method i got another 5 methods
  ...
  
  # i want another layout here
  def another_method
    # some logic
    mail(to: emails, subject: '') do |format|
      format.mjml { render: 'new_mjml_layout }
    end
  end
end

This is not working. Clearly i am doing something wrong. I want to only override the general mjml_layout for the one method, in this example the another_method.
I tried overriding the general layout like a controller using 'new_mjml_layout', only: [:another_method] and 'mjml_layout', except: [:another_method] but that didn't work either.
What am i doing wrong? This is no how it works? This just can't be done?

@GabrielLyonB If you want help it'd be great for you to create a sample project for the community to clone and debug.

FYI here's how I use it in my project:

  def email_special
    respond_to do |format|
      format.text { render layout: false }
      format.mjml { render layout: false }
    end
  end