# Problem with resources map

**URL:** <https://www.ruby-forum.com/t/problem-with-resources-map/144717>\
**Category:** Rails\
**Created:** [August 1, 2008, 1:51pm UTC](https://www.ruby-forum.com/t/problem-with-resources-map/144717 "2008-08-01T13:51:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/u/Muhammad_Arslan_Ali)\
**Post date:** [August 1, 2008, 1:51pm UTC](https://www.ruby-forum.com/t/problem-with-resources-map/144717/1 "2008-08-01T13:51:11Z")

</div>

I am facing problem with resource map

I have controller of artst

class ArtistController \< ApplicationController

in routes I have map.resources :artist

and in view

```
            <% for i in @artist %>

                            <tr>

                                            <td><%= i.id %></td>

                                            <td><%= i.name %></td>

                                            <td><%=

```

i.created\_at.strftime("%Y-%m-%d")%\>

```
                                            <td><%=

```

i.updated\_at.strftime("%Y-%m-%d") %\>

```
                                            <td><%= link_to 'Edit',

```

edit\_artist\_path(i) %\>

```
                            </tr>

            <% end %>

```

edit\_artist\_path(i) produces link as artists/1/edit

and I want link as artists/edit/1

How can I do that ?

Internal Virus Database is out-of-date.  
Checked by AVG Free Edition.  
Version: 7.5.516 / Virus Database: 269.19.21/1263 - Release Date:  
2/6/2008  
8:14 PM

---

<div class="post-metadata">

**Author:** ![Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/u/Muhammad_Arslan_Ali)\
**Post date:** [August 1, 2008, 2:09pm UTC](https://www.ruby-forum.com/t/problem-with-resources-map/144717/2 "2008-08-01T14:09:20Z")

</div>

You’re using the REST routes. ‘artists/1/edit’ is the expected result  
for this.

If you want the default routes, you could just erase  
map.resources :artists

and then the routing of artists/edit/1 will fall back onto the default  
route, if this is still at the bottom of your routes.rb:  
map.connect ‘:controller/:action/:id’  
this way ‘artists/edit/1’ will work.

HTH,

Elise

---

<div class="post-metadata">

**Author:** ![Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/u/Muhammad_Arslan_Ali)\
**Post date:** [August 1, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/problem-with-resources-map/144717/3 "2008-08-01T14:21:02Z")

</div>

That doesn’t follow the rails way of doing things. You will find your  
life a lot easier if you “go with the flow” in regards to rails  
traditions. To get that url you could just stop using map.resources  
and specify \<%= link\_to ‘Edit’, { :controller \> “artists”, :action =\>  
“edit”, :id =\> i.id } %\> instead.
