简体   繁体   中英

How to disable a layout for a specific mailer?

I need to be able to disable a certain layout for a specific email. I've taken a look at Rails for ActionMailer - How to disable a Layout for a certain mailer however I don't know where to and how to output the code necessary. I'm new to Ruby and have searched the API documentation and can't find the exact line of code I need.

class YourMailer

  layout false, only: [:mail_method1, :mail_method2]

  def mail_method1
    #your code
  end

你可以粗略,只需在mail()调用之前执行此操作:

@_action_has_layout = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM