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.body i.e. the response that the view returns?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can write a rack middleware to do such kind of replacements. Code for the rack is.
include it in some file, lets call it dump_response.rb in RAILS_ROOT/lib folder.
And line
in config.ru