How to render erb template to string inside action?

前端 未结 4 1776
囚心锁ツ
囚心锁ツ 2020-12-16 14:52

I need a string of html (something like \"Hello World\") for faxing purpose.

I wrote it into a seprat

4条回答
  •  一整个雨季
    2020-12-16 15:22

    Use the #render_to_string method

    it works the same way as the typical render method but useful when you need to add some templated HTML to a json response

    http://apidock.com/rails/ActionController/Base/render_to_string

提交回复
热议问题