instance method
body=
Ruby on Rails 8.1.2
Since v3.0.20Signature
body=(body)
Allows you to manually set or override the response body.
Parameters
-
bodyreq
Source
# File actionpack/lib/action_dispatch/http/response.rb, line 384
def body=(body)
# Prevent ActionController::Metal::Live::Response from committing the response prematurely.
synchronize do
if body.respond_to?(:to_str)
@stream = build_buffer(self, [body])
elsif body.respond_to?(:to_path)
@stream = body
elsif body.respond_to?(:to_ary)
@stream = build_buffer(self, body)
else
@stream = body
end
end
end
Defined in actionpack/lib/action_dispatch/http/response.rb line 384
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Response