# Adding custom conditions to map.resources

**URL:** <https://www.ruby-forum.com/t/adding-custom-conditions-to-map-resources/140415>\
**Category:** Rails\
**Created:** [June 13, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/adding-custom-conditions-to-map-resources/140415 "2008-06-13T18:03:19Z")\
**Posts on this page:** 1\
**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:** [June 13, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/adding-custom-conditions-to-map-resources/140415/1 "2008-06-13T18:03:19Z")

</div>

I’m doing some route hacking and have run into something I haven’t  
been able to get past. I need to add a custom condition on to RESTful  
resources in the same way that you can add custom conditions to other  
routes. I have already hacked on my solution for most routes by  
chaining to recognition\_conditions, but the conditions seem to be  
ignored by RESTful routes.

The desired behavior would be to pass a :conditions =\> {:subdomain =\>  
true/false} and have that run a logic check to see whether the  
subdomain of the current host matches against a list of allowed  
subdomains. I have the logic, it works fine for most routes, but I  
can’t see how to add conditions to the RESTful routes since they  
aren’t picked up by the rest.

Any help would be appreciated.

Thanks,  
Michael B.
