# Resource api docs not working for me

**URL:** <https://www.ruby-forum.com/t/resource-api-docs-not-working-for-me/156701>\
**Category:** Rails\
**Created:** [January 1, 2009, 2:02pm UTC](https://www.ruby-forum.com/t/resource-api-docs-not-working-for-me/156701 "2009-01-01T14:02:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 1, 2009, 2:02pm UTC](https://www.ruby-forum.com/t/resource-api-docs-not-working-for-me/156701/1 "2009-01-01T14:02:34Z")

</div>

Hi,

ruby 1.8.4, rails 2.2.2, mongrel 1.5.1, win xp

I read in the docs that this :

map.resources :articles do |article|  
article.resources :comments  
end

should result in this lot:

article\_comments\_url(@article)  
article\_comment\_url(@article, @comment)

article\_comments\_url(:article\_id =\> @article)  
article\_comment\_url(:article\_id =\> @article, :id =\> @comment)

So when I did my own idea of the above :

map.resource :people,:singular=\>:person do |person|  
person.resources :invitations;  
end

I was surprised to find no method such as person\_invitations (with or  
without the :singular=\>true): all the methods are pluralised for  
people. And for those methods that do exist none take the person id,  
even the index method (which makes it useless to me). Here is what  
rake is telling me are my routes:

people\_invitations GET /people/invitations  
formatted\_people\_invitations GET /people/  
invitations.:format  
POST /people/invitations  
POST /people/invitations.:format  
new\_people\_invitation GET /people/invitations/new  
formatted\_new\_people\_invitation GET /people/invitations/  
new.:format  
edit\_people\_invitation GET /people/invitations/:id/edit  
formatted\_edit\_people\_invitation GET /people/invitations/:id/  
edit.:format  
people\_invitation GET /people/invitations/:id  
formatted\_people\_invitation GET /people/  
invitations/:id.:format  
PUT /people/invitations/:id  
PUT /people/invitations/:id.:format  
DELETE /people/invitations/:id  
DELETE /people/invitations/:id.:format

Ideally I want to be able to do

```
link_to person_invitations(@person)

```

and get

```
href="/people/2/invitations"

```

anyone got any ideas. What have I missed.

---

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [January 4, 2009, 3:29am UTC](https://www.ruby-forum.com/t/resource-api-docs-not-working-for-me/156701/2 "2009-01-04T03:29:19Z")

</div>

I’m not entirely sure what you were trying to do with the singular  
person  
thing. Rails should automatically pluralize or singularize words for  
you.  
And if you wanted singular then just say;\> map.resource person

but if you’re going to have multiple persons then you’ll want the;

> map.resources people

With the invitations, are those supposed to be individually accessed? If  
you  
just want a page for each person that lists that person’s invitations,  
then  
I think you can/should say;

> map.resources people do |person|
> 
> > person.resource invitations  
> > end

I hope this helps.

-Tyler
