You could try making the default value nil. Makes more sense anyway -
nil indicates lack of data, while 0 suggests there is a default image.
On Thu, Feb 26, 2009 at 12:07 PM, Petan Cert
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> my default value for variable mainimage_id is 0. I am trying to apply
> really basic validation. If mainimage_id is 0 it should fail and if it
> is > 0 it should pass the validation.
>
> validates_numericality_of :mainimage_id, :greater_than => 1, :message
=>
> "Choose image."
>
> This will pass the validation even if the value is 0.
> Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---