# Map.resources doubt

**URL:** <https://www.ruby-forum.com/t/map-resources-doubt/149946>\
**Category:** Rails\
**Created:** [October 1, 2008, 1:01pm UTC](https://www.ruby-forum.com/t/map-resources-doubt/149946 "2008-10-01T13:01:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nilez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@nilez](https://www.ruby-forum.com/u/nilez)\
**Post date:** [October 1, 2008, 1:01pm UTC](https://www.ruby-forum.com/t/map-resources-doubt/149946/1 "2008-10-01T13:01:00Z")

</div>

Hi Rails experts,

```
   I have one doubt regarding map.resources.
   I am not clear with when to use :method and :collection in

```

map.resources. Please help me out.

Thanks.

---

<div class="post-metadata">

**Author:** ![nilez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@nilez](https://www.ruby-forum.com/u/nilez)\
**Post date:** [October 1, 2008, 2:46pm UTC](https://www.ruby-forum.com/t/map-resources-doubt/149946/2 "2008-10-01T14:46:15Z")

</div>

Nilesh K. wrote:

> Hi Rails experts,
> 
> ```
> I have one doubt regarding map.resources.
> I am not clear with when to use :method and :collection in
> 
> ```
> 
> map.resources. Please help me out.
> 
> Thanks.

method is for adding new actions that deal with a single instance of the  
mode in question.

collection is for adding new methods that deal with, well, a collection  
of the model in question.

I have:

map.resources :projects, {:collection =\> {:recent =\> :get}, :member =\>  
{:copy =\> :get, :pdf =\> :get}}

so I have a “recent projects” that works on the collection of  
projects(returning the most recent 10), and “copy” and “pdf” that work  
on an individual project.

---

<div class="post-metadata">

**Author:** ![nilez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@nilez](https://www.ruby-forum.com/u/nilez)\
**Post date:** [October 1, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/map-resources-doubt/149946/3 "2008-10-01T14:39:52Z")

</div>

> **[rails.info](http://guides.rails.info/routing/routing_outside_in.html)**
>
> Ruby on Rails,Rails Tutorial,Ruby Basics,Rails 4,Bar Rails,Rail

On Wed, Oct 1, 2008 at 12:00 PM, Nilesh K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi Rails experts,
> 
> ```
> I have one doubt regarding map.resources.
> I am not clear with when to use :method and :collection in
> 
> ```
> 
> map.resources. Please help me out.
> 
> Thanks.
> 
> >

–  
Cheers!

- Pratik  
[http://m.onkey.org](http://m.onkey.org)

---

<div class="post-metadata">

**Author:** ![nilez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@nilez](https://www.ruby-forum.com/u/nilez)\
**Post date:** [October 2, 2008, 2:26pm UTC](https://www.ruby-forum.com/t/map-resources-doubt/149946/4 "2008-10-02T14:26:54Z")

</div>

Thanks Chron for ur reply!

On Wed, Oct 1, 2008 at 6:16 PM, Ar Chron
