In rails, can I access response.body in a action before it returns?

后端 未结 4 1448
無奈伤痛
無奈伤痛 2021-01-05 11:08

In rails, can I access response.body in a action before it returns?

Say I want to do some final string replacements before it returns, can I get access to response.b

4条回答
  •  臣服心动
    2021-01-05 11:14

    The poor-man's way is to do this:

    str = render_to_string "mycontroller/mytemplate"
    str.gsub!(/blah/,'')
    render :text => str 
    

提交回复
热议问题