# :only and :except not working for map.resources

**URL:** <https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372>\
**Category:** Rails\
**Created:** [November 15, 2008, 11:08pm UTC](https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372 "2008-11-15T23:08:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@nickh](https://www.ruby-forum.com/u/nickh)\
**Post date:** [November 15, 2008, 11:08pm UTC](https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372/1 "2008-11-15T23:08:37Z")

</div>

Hi guys. I’m trying to get rid of some non-existing routes. My  
UserSessionsController has three methods: new, create, and destroy.  
However, in routes.rb , I’m generating the 7 RESTful routes:  
map.resource :user\_session

So, I thought that this would generate routes for the 3 actions that  
do exist:  
map.resource :user\_session, :only =\> [:new, :create, :destroy]

However, after adding that, ``rake routes’’ still spits out the other  
4 routes:  
[http://rafb.net/p/kRS3DD41.html](http://rafb.net/p/kRS3DD41.html)

Any idea what’s going on here? Thanks,  
Nick

---

<div class="post-metadata">

**Author:** ![nickh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@nickh](https://www.ruby-forum.com/u/nickh)\
**Post date:** [November 15, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372/2 "2008-11-15T23:47:52Z")

</div>

Nick,

The :except and :only routing options are only available on Edge Rails  
(Rails 2.2.1 or Rails 2.2 RC2) at this time. Make sure you are running  
the correct version.

Cheers

–  
Robert Z.  
Zapient, LLC  
Ruby on Rails Development and Consulting

[http://www.zapient.com](http://www.zapient.com)

> **[From Java To Ruby](http://www.fromjavatoruby.com)**
>
> and everything in between...

---

<div class="post-metadata">

**Author:** ![nickh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@nickh](https://www.ruby-forum.com/u/nickh)\
**Post date:** [November 16, 2008, 5:29am UTC](https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372/3 "2008-11-16T05:29:57Z")

</div>

On Nov 15, 10:35 pm, Nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks Robert. I had no idea that was the case. I figured that the  
> docs at [api.rubyonrails.org](http://api.rubyonrails.org) were applicable to the current stable  
> version, rather than Edge.  
> -Nick

Ack, my bad. The :except and :only options aren’t listed on  
[api.rubyonrails.org](http://api.rubyonrails.org) yet. I found them in the “Rails Routing From The  
Inside Out” Rails Guide:  
[http://guides.rubyonrails.org/routing\_outside\_in.html](http://guides.rubyonrails.org/routing_outside_in.html)

---

<div class="post-metadata">

**Author:** ![nickh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@nickh](https://www.ruby-forum.com/u/nickh)\
**Post date:** [November 16, 2008, 4:36am UTC](https://www.ruby-forum.com/t/only-and-except-not-working-for-map-resources/153372/4 "2008-11-16T04:36:11Z")

</div>

On Nov 15, 5:47 pm, Robert Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Zapient, LLC  
> Ruby on Rails Development and Consulting
> 
> [http://www.zapient.comhttp](http://www.zapient.comhttp)://www.fromjavatoruby.com

Thanks Robert. I had no idea that was the case. I figured that the  
docs at [api.rubyonrails.org](http://api.rubyonrails.org) were applicable to the current stable  
version, rather than Edge.  
-Nick
