On 9/22/06, sbellware <sbellware-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Is there a validation in rails that works on child objects that are
> declared as associations.
>
> eg: I have an Order class and a LineItem class, where Order has_many
> :line_items. Is there a validation that would allow me to ensure that
> an order is only valid when it has at least on line item?
Sure, validates_size_of :line_items, :minimum => 1
jeremy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---