2011-10-04 4 views

답변

3

def example_action 
UserMailer.notifier(request.protocol, request.host_with_port).deliver 
end 

은 notifier.html.erb보기에서 user_mailer 클래스

def notifier(protocol, host) 
    @protocol = protocol 
    @host = host 
    mail(:from => "[email protected]", :to => "[email protected]", :subject => "Ur nice image path") 
end 

아래 추가합니다.

<%= image_tag("#{@protocol}#{@host}/images/image_name.xxx")%> 
+0

감사합니다. Sanankhalid. 내 모델로 메일을 보내면 여전히 request.protocol 및 request.hot_with_port에 액세스 할 수 있습니까? – chell

+0

모델에서 요청 상수를 사용할 수 없으면 컨트롤러를 통해 이것을 보내야합니다. –

관련 문제