method
uuid
v3.2.13 -
Show latest stable
- Class:
ActionDispatch::Request
uuid()public
Returns the unique request id, which is based off either the X-Request-Id header that can be generated by a firewall, load balancer, or web server or by the RequestId middleware (which sets the action_dispatch.request_id environment variable).
This unique ID is useful for tracing a request from end-to-end as part of logging or debugging. This relies on the rack variable set by the ActionDispatch::RequestId middleware.
1Note
Generate Token
For generate a token, make this:
def generate_token
self.token = SecureRandom.uuid
end
SecureRandom return a number random and the uuid make this number be unique. This a good idea for use in shopping cart, for example