阅读背景:

Rails自定义验证——只有一条记录是正确的

来源:互联网 

I'm trying to write a validation where only one record can be true. I have a 'game' model with an 'active' boolean column, only one game can be active at any time, so if someone tries to create a new 'game' record when there is an already active game then they should get an error. Below is what I currently have but isn't working!I'm trying to write a validation where only one




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: