I have a user model that has_one signup.
I'm having a recurring bug where users will click multiple times and create many unnecessary si开发者_JAVA技巧gnups. How can I validate the user only gets one? Is there a way to do that from the model?
Not sure about your model, but validates_uniqueness_of might be what you are looking for.
In rails 3 you could do like this.
validates :field, :uniqueness => true
If you want your custom message then
validates :field, :uniqueness => {:message => 'your message'}
精彩评论