---
title: "Limited has_many associations"
description: "Limited has_many associations"
canonical: https://oozou.com/til/limited-has_many-associations-31
locale: en
date: 2020-10-13
topic: ruby-on-rails
---

# Limited has_many associations

> Limited has_many associations

Published: 2020-10-13 · Topic: [ruby on rails](https://oozou.com/til-topics/ruby-on-rails) ([markdown](https://oozou.com/til-topics/ruby-on-rails.md))

```ruby
# app/models/user.rb
has_one :four_car_garage
has_many :cars
validates :cars, length: { maximum: 4 }
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
