阅读背景:

Rails 3 app model如何确保一次只将一个布尔字段设置为true

来源:互联网 

I have a Logo model that has fields of name:string, default:boolean. I want the true value to be unique, so that only one item in the database can be set to true at once. How do I set my update and new actions in my controller to set all the rest of the values of my logos to false? I have a Logo model that has fields of name:str




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

分享到: