How to run all output through gem before returning the html/json/etc to browser in RoR?

时间:2015-07-28 15:57:47

标签: ruby-on-rails

As stated, how do I take everything ever rendered from a controller action in Rails through a method in a gem so I can parse the output for specific text?

1 个答案:

答案 0 :(得分:0)

Try using

response.body

According to http://api.rubyonrails.org/classes/ActionDispatch/Response.html#method-i-body this returns the content of the response as a string. This contains the contents of any calls to render.