# Mix Resources and non Resource routes

**URL:** <https://www.ruby-forum.com/t/mix-resources-and-non-resource-routes/123802>\
**Category:** Rails\
**Created:** [December 20, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/mix-resources-and-non-resource-routes/123802 "2007-12-20T19:30:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 20, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/mix-resources-and-non-resource-routes/123802/1 "2007-12-20T19:30:23Z")

</div>

Hello,

I have this routing right now:

map.resources :events do |event|  
event.resources :invitations  
event.resources :personalized\_invitations  
event.resources :questions  
end

Now I want to add to the event resource other non resourceful routes.  
In my case, this new route will be for my notification controller. Per  
se notifications belongs to an event but are not resources so I don’t  
want to use:

event.resources :notifications, :member=\>[my notif actions here]

I would like the notification controller to behave as the default  
rails routing but within the event scope. Something like this:  
event.connect ‘:controller/:action/:id’

and then be able to have this kind of URL:  
[http://localhost:3000/events/notification/send/1](http://localhost:3000/events/notification/send/1)

Is it possible to have such routing? How can I do this?

Thank you,  
Julien.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 20, 2007, 8:44pm UTC](https://www.ruby-forum.com/t/mix-resources-and-non-resource-routes/123802/2 "2007-12-20T20:44:52Z")

</div>

Use named route:

map.notification ‘events/notification/send/:id’, :controller =\>  
‘ur\_controller\_name’, :action =\> ‘send’

The new way declaring your routes is:

map.resources :events , :has\_many =\> [:invitations,  
:personalized\_invitations, :questions]

On Dec 20, 2007 10:30 AM, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> and then be able to have this kind of URL:  
> [http://localhost:3000/events/notification/send/1](http://localhost:3000/events/notification/send/1)
> 
> Is it possible to have such routing? How can I do this?

–  
[http://www.rubyplus.org/](http://www.rubyplus.org/)  
Free Ruby Screencasts

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 24, 2008, 3:05pm UTC](https://www.ruby-forum.com/t/mix-resources-and-non-resource-routes/123802/3 "2008-01-24T15:05:38Z")

</div>

Hi,

Bala P. wrote:

> Use named route:
> 
> map.notification ‘events/notification/send/:id’, :controller =\>  
> ‘ur\_controller\_name’, :action =\> ‘send’
> 
> The new way declaring your routes is:
> 
> map.resources :events , :has\_many =\> [:invitations,  
> :personalized\_invitations, :questions]

Sorry but, how can then you relate this map.resources :events with the  
previous map.notification named routes created?  
I mean, you are not mixing. You are just creating a named route with the  
same first path as map.resources :events.
