可以将uuid的包拷贝到vendor/plugins下,或者在Gemfile里加上
?
gem 'uuidtools'
?
示例:
?
require "uuidtools" UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "2015.iteye.com") # a8d2b2e9-c6ce-3d87-b44a-a5edb8ce907e UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "2015.iteye.com") # cb0ebd98-8dd8-5db7-a817-6725c0725401 UUIDTools::UUID.timestamp_create # 81d96c20-f220-11e0-bee8-005056c00001 UUIDTools::UUID.random_create # 48420262-8a94-41f2-8df0-9396ee9aacfc
?
官方地址:http://uuidtools.rubyforge.org/