Wednesday, April 18, 2012

[Rails] Re: validates_uniqueness_of question

Hi All,

I am trying write a validation rule where I need to ensure that when a certain value is updated or created in a particular columns, a number of other columns columns are unique and that another column does not contain a certain value.

I have been able to use the validates_uniqueness_of :column_a (to be updated or inserted) with , :scope => [ :column_b ,  :column_c ,  :column_d ] .  This works well but now I also need to extend it so that a certain column is not equal to 0.

How can I extend the validation rule to also include that a check is carried out that this other column does not equal to 0

Kind Regards

Gurdipe

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OJ2hZjPJhR0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate