Re: [Rails] Re: validates_uniqueness_of question
On Wed, Apr 18, 2012 at 15:18, Gurdipe Dosanjh <rhomobileapps@gmail.com> wrote:
> 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
You can use an exclusion clause. See:
http://guides.rubyonrails.org/active_record_validations_callbacks.html#exclusion
It uses an array, which in your case would just be [0]. There might
be a way to do just a single value, I don't know offhand, never had
to. Let us know if you find something like that....
-Dave
--
Dave Aronson: Available Cleared Ruby on Rails Freelancer
(NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at
www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
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