rails loop
来源:互联网 发布:tv域名能备案吗 编辑:程序博客网 时间:2024/06/08 03:06
rails 用户添加session使用loop循环
models/user.rb
before_create :generate_authentication_tokendef generate_authentication_token loop do self.authentication_token = SecureRandom.base64(64) break if !User.find_by(authentication_token: authentication_token) end end
订单号的产生
models/order.rb
before_create :save_order_number def save_order_number loop do self.order_number = "EZC"+Time.now.strftime('%Y%m%d')+rand(100000).to_s break if !Order.find_by(order_number: order_number) end end
0 0
- rails loop
- loop
- loop
- Loop
- loop
- Loop & Loop
- Rails
- Rails
- Rails
- rails
- Rails
- rails
- Rails
- Rails
- Rails
- Rails
- Rails
- Rails
- C# 委托的一个实现
- 朋友圈中的英语
- Openstack基础简单笔记(1)
- Hadoop2.x YARN架构
- IDEA工具开发中部署工程常见问题
- rails loop
- DZ相关知识
- 海量数据分页limit,解决思路
- 深入Web请求过程
- MyEclipse连接Mysql
- 冒泡排序函数
- rails 验证
- 蓝桥杯-Multithreading(java)
- OpenCV检测篇——猫脸检测