I suppose you could write a custom validator to ensure that no more than 5
child objects exist.

On Sun, Jul 5, 2009 at 5:12 PM, Michal Burak <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hi,
>
> Is there any way to specify a a validation rule or something for the
> "has_many' relationship so that it would count the related objects?
>
> For e.g. I want my Foo object to have maximum of 5 Bar objects in
> has_many relationship.
>
> M.
> --
> Posted via http://www.ruby-forum.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to