2
보기 내 Liquid 템플릿을 사용하여 이메일을 보낼 때 Email
개체에 Liquid error: undefined method 'to_liquid' for #<Email:0x007f9ca1a62d28>
오류가 발생합니다. 그러나 브라우저에서보기 만 렌더링하면 잘 작동합니다! 내 메일러의메일에서 "to_liquid"메서드가 정의되어 있지 않습니다.
= raw @template.render('email' => @email, 'organization' => @organization)
%p= sanitize("<a href='{{ unsubscribe_url }}''>Click here to unsubscribe</a>")
%p{style:'text-align:center;'}
Sent with
= link_to 'Vocalem', 'http://vocalem.com'
관련 부품 : 여기
내 뷰의class BulkMailer < ActionMailer::Base
def bulk_email(recipients, email, organization)
...
@organization = organization
@email = email
@template = Liquid::Template.parse(organization.current_email_template.body)
관련 모델 코드 :
liquid_methods :subject, :body, :id
그리고 마지막으로을의 예 액체를 제공하는 오류 (하지만 일반보기에서 잘 작동!) :
{{email.body}}
이상하게도 {{organization.display_name}}
은 오류를 발생시키지 않지만 이메일에서 완전히 공백입니다 (일반보기에서는 정상적으로 다시 작동 함에도 불구하고).
여기에 어떤 일이 일어날 수 있는지 실마리가 있습니까?
감사를 확인하십시오! 잘됐다. – Asherlc