# Strange behaviour collection on the resources

**URL:** <https://www.ruby-forum.com/t/strange-behaviour-collection-on-the-resources/137313>\
**Category:** Rails\
**Created:** [May 11, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/strange-behaviour-collection-on-the-resources/137313 "2008-05-11T22:26:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8797f3/32.png) [@blj](https://www.ruby-forum.com/u/blj)\
**Post date:** [May 11, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/strange-behaviour-collection-on-the-resources/137313/1 "2008-05-11T22:26:06Z")

</div>

My route is as follows:  
map.namespace :admin do |admin|

admin.resources :campaigns, :collection=\>{  
:auto\_complete\_for\_client\_name=\>:post,  
:auto\_complete\_for\_user\_login=\>:post}  
end

The auto complete prototype POST request for the client\_name is  
working, but the user\_login never gets properly recognized.

Though I am able to recognize the route if I add it manually instead  
of using the resources. Is anyone having such problems?

---

<div class="post-metadata">

**Author:** ![blj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8797f3/32.png) [@blj](https://www.ruby-forum.com/u/blj)\
**Post date:** [May 12, 2008, 3:21am UTC](https://www.ruby-forum.com/t/strange-behaviour-collection-on-the-resources/137313/2 "2008-05-12T03:21:29Z")

</div>

This may not be any help, but I might learn something.

I pasted your route declaration and got, among others, these two  
routes from rake routes.

auto\_complete\_for\_user\_login\_admin\_campaigns POST /admin/campaigns/  
auto\_complete\_for\_user\_login  
{:controller=\>“admin/  
campaigns”, :action=\> “auto\_complete\_for\_user\_login”}

formatted\_auto\_complete\_for\_user\_login\_admin\_campaigns POST /admin/  
campaigns/auto\_complete\_for\_user\_login.:format  
{:controller=\>“admin/  
campaigns”, :action=\>“auto\_complete\_for\_user\_login”}

What route is it you don’t have?  
can you post the code that manually adds the route?

if you need to get rid of the admin in the route add “:name\_prefix =\>  
nil”  
auto\_complete\_for\_user\_login\_admin\_campaigns goes to:  
auto\_complete\_for\_user\_login\_campaigns

map.namespace :admin do |admin|

admin.resources :campaigns, :collection=\>{  
:auto\_complete\_for\_client\_name=\>:post,  
:auto\_complete\_for\_user\_login=\>:post}, :name\_prefix  
=\> nil  
end

On May 11, 1:15 pm, blj [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My route is as follows:  
> map.namespace :admin do |admin|
> 
> admin.resources :campaigns, :collection=\>{ :auto\_complete\_for\_client\_name=\>:post, :auto\_complete\_for\_user\_login=\>:post}  
> end
> 
> The auto complete prototype POST request for the client\_name is  
> working, but the user\_login never gets properly recognized.

---

<div class="post-metadata">

**Author:** ![blj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8797f3/32.png) [@blj](https://www.ruby-forum.com/u/blj)\
**Post date:** [May 12, 2008, 8:21pm UTC](https://www.ruby-forum.com/t/strange-behaviour-collection-on-the-resources/137313/3 "2008-05-12T20:21:19Z")

</div>

Well thanks for the response. I am not sure what the error was. After  
I updated my rails copy to the more recent from edge, it started to  
work.
