# :member resources actions and :requirements

**URL:** <https://www.ruby-forum.com/t/member-resources-actions-and-requirements/144109>\
**Category:** Rails\
**Created:** [July 25, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/member-resources-actions-and-requirements/144109 "2008-07-25T13:43:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58f4c7/32.png) [@ericd](https://www.ruby-forum.com/u/ericd)\
**Post date:** [July 25, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/member-resources-actions-and-requirements/144109/1 "2008-07-25T13:43:57Z")

</div>

Hi!

I’m having a bit of trouble with routes requirements for resources.  
Using Rails 2.0.2, I tried to specify that an explorer id (which  
actually is its login as a permalink) could contain dots, minus, or  
underscores thanks to requirements :

##################################################  
######## config/routes.rb  
map.resources :explorers,  
:requirements =\> { :id =\> /[\w.-\_]+/},  
:collection =\> { :search =\> :post}  
:member =\> { :languages =\> :any,  
:map =\> :get}

####### a/models/explorer.rb

class Explorer \< ActiveRecord::Base  
def to\_param  
login  
end  
end

##################################################

For explorers without ‘.’ in their login, every route works fine and

explorers  
explorers/john  
explorers/john/map

are all recognized.

But for example :

## explorers/john.doe will get recognized while explorers/john.doe/map will raise:

Routing Error

## No route matches “/explorers/john.doe/map” with {:method=\>:get}

It seems like :requirements option is only taken into account for  
basic resources actions, not the one that have been added via :member.

Is there a way to force :requirements for :member actions, or do I  
have to write usual routes individually and map them to  
“#{action}\_explorer”?

Thanks a lot for your attention & have a nice week-end,

Eric
