# How can we condense these nested routes

**URL:** <https://www.ruby-forum.com/t/how-can-we-condense-these-nested-routes/149338>\
**Category:** Rails\
**Created:** [September 23, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/how-can-we-condense-these-nested-routes/149338 "2008-09-23T20:42:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [September 23, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/how-can-we-condense-these-nested-routes/149338/1 "2008-09-23T20:42:13Z")

</div>

I have the following:

map.resources :pages, :has\_many =\> :categories  
map.resources :pages, :has\_many =\> :images

Is there a proper way to condense the above?

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [September 23, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/how-can-we-condense-these-nested-routes/149338/2 "2008-09-23T21:24:48Z")

</div>

Am Dienstag, den 23.09.2008, 20:42 +0200 schrieb Bob S.:

> I have the following:
> 
> map.resources :pages, :has\_many =\> :categories  
> map.resources :pages, :has\_many =\> :images
> 
> Is there a proper way to condense the above?

try map.resources :pages, :has\_many =\> [:categories, :images]

Greetings  
Johannes

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [September 23, 2008, 9:38pm UTC](https://www.ruby-forum.com/t/how-can-we-condense-these-nested-routes/149338/3 "2008-09-23T21:38:36Z")

</div>

Johannes J. Schmidt wrote:

> Am Dienstag, den 23.09.2008, 20:42 +0200 schrieb Bob S.:
> 
> > I have the following:
> > 
> > map.resources :pages, :has\_many =\> :categories  
> > map.resources :pages, :has\_many =\> :images
> > 
> > Is there a proper way to condense the above?
> 
> try map.resources :pages, :has\_many =\> [:categories, :images]
> 
> Greetings  
> Johannes

Thanks so much Johannes!
