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-l...@andreas-s.net> 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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to