# Can i limit a has\_many photos per user?

**URL:** <https://www.ruby-forum.com/t/can-i-limit-a-has-many-photos-per-user/89038>\
**Category:** Rails\
**Created:** [March 16, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/can-i-limit-a-has-many-photos-per-user/89038 "2007-03-16T18:02:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![treebeard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@treebeard](https://www.ruby-forum.com/u/treebeard)\
**Post date:** [March 16, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/can-i-limit-a-has-many-photos-per-user/89038/1 "2007-03-16T18:02:00Z")

</div>

is there a rails way?

or should i just a do a before\_save :check\_limit, and just tally up the  
amount of photos before saving? so maybe do something like

if user.photos.count == 4, max limit set. etc…

thanks
